How to access a node not in the current scene tree?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By olek0

Im new to Godot and programming so sorry if you dont understand the question

Im currently making a puzzle platformer. Right now I’m trying to make buttons like the buttons in Portal. The player can activate them and deactivate them. I made a different scene for the button like I did with the spikes and the player. Im using an Area2D node to detect if the player is on the button.

I started programming the button by checking if the players position is above the buttons position, but I can’t access the player node if it is in a different scene.

I tried instancing the player node and then try accessing the node, which looked like it worked but when I tried to playtest it gave me an error saying that the variable (variable i use to store the player node in) has no value.
By the way i use the get_node() function to access the node.

Help Appreciated!