# What happens if a running script is "interrupted" by a save/push to the client?

**URL:** <https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643>\
**Category:** Ignition\
**Created:** [December 18, 2020, 1:29pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643 "2020-12-18T13:29:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [December 18, 2020, 1:29pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643/1 "2020-12-18T13:29:22Z")

</div>

Can I expect the unexpected? Will the script pick up where it left off? I have a user interaction on my client screens that seems to get buggy when I’m saving repeatedly on the gateway. I’m wondering if this might be the root cause.

---

<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:** [December 18, 2020, 2:35pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643/2 "2020-12-18T14:35:07Z")

</div>

In Vision? I would expect the script to run to completion, uninterrupted, with the object contexts (old) it started with. Any system.\* calls looking up other objects will be unreliable, as the point of switchover is not documented.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [December 18, 2020, 2:48pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643/3 "2020-12-18T14:48:15Z")

</div>

So a system.tag.write or system.tag.read would probably be unreliable?

I should elaborate. My script reads/writes some client tags, does some stuff with that information, and then does some more reads/writes to client tags.

---

<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:** [December 18, 2020, 2:56pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643/4 "2020-12-18T14:56:14Z")

</div>

I don’t recall if pushing/updating a project replaces **all** of the client tags. It must at least add/remove any changes to them from the designer. The system.tag.\* functions should _work_, but you might write an update to one, changes arrive, and then read back something unexpected.

Keep in mind that all of your scripts will be replaced by the update. You can detect the reload with code in the top level of a script module. The dictionary from system.util.getGlobals() will let you hold onto old code or objects to intelligently transfer state to new code and objects.

Consider using script module top-level dictionaries as non-divisible state management tools. Old code will work only with the old dictionary, new code will work with the new dictionary.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [December 18, 2020, 3:01pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643/5 "2020-12-18T15:01:52Z")

</div>

> [@pturmel](#):
>
> I don’t recall if pushing/updating a project replaces **all** of the client tags

From what I've seen any active client will remember it's tags after an upate. It just occurred to me that I do some system.gui.transforms() in my clients also. All my symptoms would make sense if a pushed update was killing this function.

---

<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:** [December 18, 2020, 3:06pm UTC](https://forum.inductiveautomation.com/t/what-happens-if-a-running-script-is-interrupted-by-a-save-push-to-the-client/41643/6 "2020-12-18T15:06:51Z")

</div>

Well, the update wouldn’t _kill_ the the transform() operation, just make its target invisible on its way to garbage collection, since the update will recreate all open windows.
