Script with access to the entire application (global script)

I’m thinking about the structure of an application and a question came up. I know about Persistent Nodes and I have several scenes. What is the right way to have a global script with access to the entire application? Where is the best place to place it?

What you mean of access to the entire application? You can place the script anywhere, there is no different.

I mean this section of the documentation: Scene resource management and Persistent Nodes

Starting with “The engine will only run one scene at the same time.” the question has already arisen. Logic suggests that in order to control all scenes, pass parameters between them, etc., the node with the script must be “above all scenes” in the tree. What is the correct solution in this case for the position of such a script (a node). In one of any scenes? Which one to choose?

Persistent Nodes can be used if you have something that you wanted to share across scenes.

But, for passing parameters, you may consider using just global variables or global object. For me, I created a Singleton object for common functions/attributes and exported it. Then, I imported/used it where it was needed. It was much more cleaner.

Thank you for the option. But suppose I write a script that will loop every, say, 10 seconds to load and show a new scene. Where is the best place to place such a script?

You can create a empty node to scene, add script to it, then add it as PersistRootNode.