A scene can have no script, and a script can be on multiple scenes. Godot does not have a function to do this, because it's not an enforced rule. You can somehow "link" a script with a scene by embedding it in the scene, which means it won't have a .gd
file of its own and will be stored inside the scene itself (which has some drawbacks tho, such as harder versionning, no name given and global search).
If some of your .gd
scripts are specific to one of your scenes in your project, a good practice is to give them the same name. This way, you can easily access them by quick-opening the scene by its name (Ctrl+Shift+O). The scene will open and its script will be available by clicking on the root node's script icon.