Need help getting a variable from another script.

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

I have a boolean set to attached to a node and I would like to use that boolean in another script but I’m having some difficulties.
Searched a bit in here and found out that I just need to use a dot after the get_node function in order to fetch a variable, but then I tryied wiritng down
and It gave me a Invalid get index ‘over’ (on base: ‘null istance’) error.
Tried looking around here some more and nothing proved to be uself. I tried deleting the get_node function, using the ‘$’ instead of the function, giving the path to the script instead of that of the Node but the error still comes up.
Any idea of what’s cousing this problem?

:bust_in_silhouette: Reply From: Calinou

If you get an error “on base null instance”, it is likely that the path to the node is incorrect (since get_node() is unable to fetch the instance in this case).

You can check the scene tree of a running project in real time by using the Remote Inspector in the editor while the project is running. It’s a good idea to use it, so that you can make sure you specified the node path correctly.

The tree path doesn’t change at all while the project is running.
Remote Inspector

It looks like the path I mentioned above (/root/Scene/Test) should be able to fetch this node. Double-checked to see if I misstyped the variable name somewhere but found nothing.

MyNameIsMir | 2018-05-31 21:41