Gateway Scripts - Using variables from one script in another

I have 2 gateway scripts. Due to the size of one, I need to split it into 2 different scripts… Is it possible to use variables from the first script in my second script?

Thank you in advance

Absolutely just pass them as parameters to your next script.

def function1():
     # really long script here
     # etc with what you need to pass
     someOtherLibraryScript.function2(variable1, variable2)

and then in your other function

def function2(param1, param2):
    # param1 now has value of variable1 from script 1
    # param2 now has value of variable1 from script 1

How long is your script exactly? I would highly recommend trying to break it down to smaller scripts. Take a look at this post for an example system.util.invokeLater or alternative function in global script? - #6 by bkarabinchak.psi

You can also define variables as a dictionary in the top level of a project script, this is helpful for translation codes or similar. IE

The dictionary can be accessed with staging.laborDict['E'] which will return 10375