# Perspective - Scripting - Runing scripts

**URL:** <https://forum.inductiveautomation.com/t/perspective-scripting-runing-scripts/47599>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [June 9, 2021, 2:55pm UTC](https://forum.inductiveautomation.com/t/perspective-scripting-runing-scripts/47599 "2021-06-09T14:55:54Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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 7, 2021, 11:48pm UTC](https://forum.inductiveautomation.com/t/perspective-scripting-runing-scripts/47599/5 "2021-12-07T23:48:50Z")

</div>

I'd place a python lock object in persistent memory (system.util.getGlobals() or my own system.util.persistent()) using .setdefault() to never replace it. See my suggestion over in this topic:

> [@Global objects in Perspective Scope](https://forum.inductiveautomation.com/t/global-objects-in-perspective-scope/53688/13):
>
> Replace it unconditionally in the top level of the defining script. Something like this: class myClass(): \_\_init\_\_(self, prior): # Copy important values from prior version, as long as they # are platform data types. Stop any threads stored in prior # and remove any of its listeners from the platform. pass # Get the persistent global dictionary \_g = system.util.getGlobals() # Protect the swap with a lock. Locks are defined by # the jython stdlib, so do not have to be replaced on re…

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-scripting-runing-scripts/47599)._
