In #godot, I got two variables in a #gdscript file, both holding instances of one internal class. The script is not attached to a node and I cannot access these variables. Coming from #python, I thought this would work if I could preload the script.
Do I need to attach the script to a node in order to access the class instances? I'm not sure how databases are handled here
@SteelWool You can also use singletons (autoloads) if you want to have a globally accessible class instance:
https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html
@limbo @SteelWool To add on to this, I think you can maybe achieve what you're trying to do by making the variables static. So "static var foo = ...", then I think preload("script.gd").foo should work?
@SteelWool
In GDScript, a script file is basically a definition of a class. Any variables inside are members of that class. You can access them through instance of that class, but they are not "shared" between many instances. If you want to have some "data store" functionality, there are several options. My favorite is using custom resources as data containers.