# Gateway Timer Events vs. Threading?

**URL:** <https://forum.inductiveautomation.com/t/gateway-timer-events-vs-threading/30546>\
**Category:** Ignition\
**Created:** [December 9, 2019, 4:48pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-events-vs-threading/30546 "2019-12-09T16:48:29Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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:** [May 15, 2025, 12:50am UTC](https://forum.inductiveautomation.com/t/gateway-timer-events-vs-threading/30546/7 "2025-05-15T00:50:43Z")

</div>

Ah, not good!

Although now I have more questions...  
In this example here:

> [@Managing multiple asynchronous threads](https://forum.inductiveautomation.com/t/managing-multiple-asynchronous-threads/37185/6):
>
> No, more like this: persist = system.util.persistent("someUniqueConstantName") oldFileWatcher = persist.pop("fw") persist['fw'] = FileWatcher(oldFileWatcher) def getWatcher(): return persist['fw'] Note the oldFileWatcher passed to the new one so the new one’s thread can tell it to shut down.

i.e.

```python
persist = system.util.persistent("someUniqueConstantName")
oldFileWatcher = persist.pop("fw")
persist['fw'] = FileWatcher(oldFileWatcher)

def getWatcher():
    return persist['fw']

```

My understanding from this is that when the script engine starts up again after saving the project, the new engine gets the old engine's file watcher object in order to interrupt it, kill it, and then replace it. What I don't understand though is how two interpretters can be running side-by-side with the ability to talk to each other? i.e. how can "fw" in the new interpretter point to the old interpretter's object? To me, this is like the Designer's running Python code referencing the gateway's running Python code, which I didn't think was possible. e.g. like `system.util.getGlobals('var1')` being accessible as the same object from both Designer and Gateway scopes. I'm obviously missing something fundamental here...

[I think it's time to finally do a course that goes through the nitty gritty of Python...]

---

_[View the full topic](https://forum.inductiveautomation.com/t/gateway-timer-events-vs-threading/30546)._
