# Gateway Scripts - Using variables from one script in another

**URL:** <https://forum.inductiveautomation.com/t/gateway-scripts-using-variables-from-one-script-in-another/63614>\
**Category:** Ignition\
**Tags:** perspective, ignition81, scripting\
**Created:** [August 30, 2022, 5:16pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-using-variables-from-one-script-in-another/63614 "2022-08-30T17:16:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![csilk](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@csilk](https://forum.inductiveautomation.com/u/csilk)\
**Post date:** [August 30, 2022, 5:16pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-using-variables-from-one-script-in-another/63614/1 "2022-08-30T17:16:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [August 30, 2022, 5:21pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-using-variables-from-one-script-in-another/63614/2 "2022-08-30T17:21:57Z")

</div>

Absolutely just pass them as parameters to your next script.

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

```

and then in your other function

```auto
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](https://forum.inductiveautomation.com/t/system-util-invokelater-or-alternative-function-in-global-script/42529/6)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 30, 2022, 5:26pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-using-variables-from-one-script-in-another/63614/3 "2022-08-30T17:26:03Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/e/eed3c339314100b9d664ab3de1e5766cfa976d9b.png)  
The dictionary can be accessed with `staging.laborDict['E']` which will return `10375`
