The script order isn't really well defined - I'd avoid using subfolder hacks because that's depending on weird details that might change over time.
Normally you can just put all startup code in runOnStartup
and all classes will be defined by then. However I can see it's a problem for using class X extends Y
- X has to come after Y.
You could just put both classes in the same file, one after the other, but that's not great for large classes. I think the best approach is to move any script files that depends on others to the Files folder in the project bar, so they're not automatically loaded, and then use loadScripts to load them in the right order. You can pass multiple scripts to a single loadScripts
call and they are guaranteed to run in the order you pass them.