I am trying to pass variables between two scripts without using AutoLoad/Singletons. The scripts are attached to two nodes as illustrated below:
|-o Node_A, [SCRIPT_A]
|-o Node_B, [SCRIPT_B]
When I try to use getparent().getnode() in one script to access variables from the other script, I am given autofill options that indicate that Godot knows what I am trying to access.
For example, if in SCRIPTA, I write
get_parent().get_node("Node_B") and put a
.decimal at the end, I am suggested variables from SCRIPTB.
Unfortunately, when I write something using these suggestions, like
get_parent().get_node("Node_B").var_from_script_b, I get the following compiler error:
- Invalid get index 'var_from_script_b' (on base: 'Nil').
- get_node_or_null: Can't use get_node() with absolute paths from outside the active scene tree.
Again, I am looking for a solution that does not use AutoLoad. Any help I can get would be greatly appreciated! :)