Hi machuser
Welcome to the macscripter forums.
In answer to your question.
Yes it is possable to split your ASOC projects code across several scripts, and in fact I would highly recommend you do so for large projects, as once you get beyond a few hundred lines of code, debugging becomes a headache.
I’ve worked on two very large projects over the past couple of years, one of which had 8 scripts, and the other had 9 scripts, both projects have about 3000 to 3500 lines of code, which as you can imagine would be impossable to work with in one script.
I personally try to use the MVC design pattern for my ASOC projects, although it’s not always very intuitive with ASOC projects, as it is with ObjC or Swift projects.
Also Xcode’s support for AppleScriptObjC code and projects is poor in comparison to the other aforementioned languages.
So I would advise splitting the code across scripts in a logical fashion, so use the AppDelegate script for things relating to the main applications function, for example, when the app opens or closes, or is activated or deactivated, or when files need to be opened when dropped, and handling the main window and main menu functions.
And then use other scripts for other specific functionality within the App, for example data handling or manipulation, displaying the data in the user interface, for checking system hardware or software resources and availability, setting and saving preferences, and so on in an exhaustive list.
As others on this forum will tell you, there are several ways to work with multiple scripts in projects, loading the scripts with the load script command, or initialising a reference to the script with alloc()'s init(), or calling the scripts functions directly with current applications otherScript’s method(), all of which have pro’s and con’s, and does depend on what your trying to achieve.
You can also hold a reference to other project scripts in global properties, and also have a reference to them in interface builder for event handling and UI updating.
So when you have a clearer idea of how you want make your project more modular, there are plenty of knowledgable ASOC people that hang out here, and I’m sure you could be pointed in the right direction, once you have a more specific question.
Regards Mark