To access any object's properties (variables), use dot syntax: object.variable
To get access to another node, there are few ways to do it. In this example, script is in the root node and it has child named Sprite
which has declared var my_variable
:
$Sprite.my_variable = "Hello!"
You can also search other nodes by name with find_node()