# Working with multiple Gateways - Scripting

**URL:** <https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309>\
**Category:** Ignition\
**Created:** [August 4, 2025, 7:52am UTC](https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309 "2025-08-04T07:52:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tjark\_Sterk](https://avatars.discourse-cdn.com/v4/letter/t/ac91a4/32.png) [@Tjark\_Sterk](https://forum.inductiveautomation.com/u/Tjark_Sterk)\
**Post date:** [August 4, 2025, 7:52am UTC](https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309/1 "2025-08-04T07:52:28Z")

</div>

Hey,  
I was wondering how one would handle scripting on multiple gateways, meaning if I build my own scripting library that I want to use for all projects on all gateways, how do I ensure that all gateways have access to the newest version of my library?

I could always manually copy them over but that will surely lead to problems down the line.

Could gateway networks be helpful there? I haven't played around with them.  
Anyone has a solution for this?  
BR

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 4, 2025, 7:59am UTC](https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309/2 "2025-08-04T07:59:46Z")

</div>

You could use the GAN with EAM to sync up selected resources between projects, but it wouldn't be automatic, you would need to initiate the sync manually.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [August 4, 2025, 9:18am UTC](https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309/3 "2025-08-04T09:18:17Z")

</div>

Workaround. Connecting both gateways. I haven´t share scripts, just tags,  
You can research

Set up your gateways connection

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/c/6c5bc8c062e6b7cb3f5c5801eeb4cb71795fd617.png)

use message handlers between them

### Example: Call a script on a remote gateway

**On the remote gateway (define a message handler in a project):**

```python
# Name: 'remoteScriptHandler'
def handleMessage(payload):
    arg = payload.get("arg")
    return {"result": arg.upper()}

```

**On the local gateway:**

```python
response = system.util.sendRequest(
    project='RemoteProject',
    messageHandler='remoteScriptHandler',
    payload={'arg': 'hello'},
    gateway='RemoteGatewayName',
    timeout=5000
)
result = response['result']

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 4, 2025, 11:35am UTC](https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309/4 "2025-08-04T11:35:34Z")

</div>

> [@Alejandro\_Alaco](#):
>
> Workaround.

I wouldn't call it a workaround. I would call it the solution.

It's the only way that I know of to have a script on one gateway executed from another gateway.

---

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [August 4, 2025, 1:48pm UTC](https://forum.inductiveautomation.com/t/working-with-multiple-gateways-scripting/109309/5 "2025-08-04T13:48:12Z")

</div>

For a client with the same requirement, I created a `Global` project (where all global resources are defined - including a script library), which is sync'd periodically (daily, via EAM task) to all gateways under the umbrella. There, all projects which need access to these scripts are intended to be created with the `Global` project as a parent project.

I suppose one could build an "On Update" event which automatically runs the EAM task whenever the `Global` project is saved... Since editing global resources is **not** a regular occurrence, and since it's beneficial to verify/test changes before pushing everywhere, we initiate a "Run Once" on the EAM task after any changes are made. Worst-case, everything will synchronized again 'by tomorrow'.
