# Gateway event code seems to be executing twice

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [June 27, 2023, 4:43pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595 "2023-06-27T16:43:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 27, 2023, 4:43pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/1 "2023-06-27T16:43:36Z")

</div>

I have some Gateway events, based on tag changes that run some script code. They are calling some functions from a library that is in a project that is inherited, in case that may factor in.

I am having a problem where I have some functions that seem to be running 'twice' when I get the tag change event. I have troubleshot and am not getting the OPC/plc signal twice, or multiple times.

As you can see on the first screen shot, most of them are disabled. I have enabled the ones I need for testing here in production. Even when disabled, the code in the tag change event highlighted here is still running. When enabling it, then I get the results twice.

I have several projects in this gateway, that are mostly vision/HMI projects, and these gateway tag event scripts exist on one of them. I have scoured all the rest of the projects, as well as for client tag events to see if I have errantly put these elsewhere in testing, and I can find nothing.

Is there some other troubleshooting I can do to find where this script code might be running from, when I have the tag event scripts disabled? Thanks.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/e/1e3d1aaf7a046d26d2bf1c885973670410255a88.png)

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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 27, 2023, 4:48pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/2 "2023-06-27T16:48:20Z")

</div>

If you want to rule out inheritance _and_ check whether the script is firing twice...

```python
system.util.getLogger("Gateway Script Debug").infof("Project: %s, firing event", system.project.getProjectName())

```

Just drop that line (or something like it) at the beginning of your script.

---

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 27, 2023, 5:30pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/3 "2023-06-27T17:30:34Z")

</div>

> [@paul-griffith](#):
>
> `system.util.getLogger("Gateway Script Debug").infof("Project: %s, firing event", system.project.getProjectName())`

OK. Thanks. I did that and only got one line, or one firing.

---

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 27, 2023, 5:31pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/4 "2023-06-27T17:31:23Z")

</div>

one firing of the inherited function script, but still 'dual results'

---

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 27, 2023, 10:08pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/5 "2023-06-27T22:08:12Z")

</div>

Duh... I stumbled on it.. I have a gateway running on my dev laptop here that was hooked to our same controls network for troubleshooting, etc. It happened to be a restore of the production backup we are using here on site. Thus both gateways were running and active. I stopped the service on my laptop , disabled the service and bingo. Never thought of it until stumbling on...

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 27, 2023, 10:14pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/6 "2023-06-27T22:14:00Z")

</div>

I hope you uninstalled from your dev laptop.... That is problem likely to recur if you don't.

---

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 27, 2023, 10:38pm UTC](https://forum.inductiveautomation.com/t/gateway-event-code-seems-to-be-executing-twice/75595/7 "2023-06-27T22:38:00Z")

</div>

I will. I stopped and disabled the Ignition service to start to test that was it, but I'll uninstall.
