I see. Ok, the problem here is that there is a confusion between how scenes work and the file system. The get_node
function allows you to access nodes, but this nodes must be instanced in the Scene Tree
. This means you cannot access the node Menu
(which is also a scene) because it is not loaded yet. You must understand that using the /root/
node path gives you access to the root node, and not to the root directory of your project in the filesystem. So the way you organice your directories and files has absolutely nothing to do with how you use the scenes in Godot engine.
To use your Menu
node in Scene1
you have several approaches. You can create another scene, lets ctall it GameScene
(or whatever) and add the Scene1
and Menu
scenes as nodes. Then make this GameScene
your main scene. Scene1
will be able to access Menu
by using get_node('../Menu')
. Your GameScene
will function as a sort of Main game handler, and manage global stuff.
If you don't like that approach, then using the Menu
scene as a singleton and adding it to the autoload in your configuration might be what you are looking for. This adds the Menu
scene to the Scene Tree
when the game starts and makes it accesible to all scenes by using the method you already tried get_node('/root/Menu')
.
The other way to go about this is probably instance the Menu
scene as a node inside the Scene1
node. Then you could call the menu by using get_node('Menu')
I hope this helps you decide how to approach your node design.