Obviously I'm ignorant of the specifics here 🙂 but in general, I like to put the business logic in its own library files/common modules, then let the Script files just act as entry points to business logic. I like keeping my Script files very minimal, just delegating to other libraries/modules.