# Global Scripting Variables (Library Script Top-Level Vars)

**URL:** <https://forum.inductiveautomation.com/t/global-scripting-variables-library-script-top-level-vars/60516>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [June 8, 2022, 8:22pm UTC](https://forum.inductiveautomation.com/t/global-scripting-variables-library-script-top-level-vars/60516 "2022-06-08T20:22:43Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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 8, 2022, 8:50pm UTC](https://forum.inductiveautomation.com/t/global-scripting-variables-library-script-top-level-vars/60516/8 "2022-06-08T20:50:03Z")

</div>

Be aware that the value will be lost if you edit and save the project--that causes a script restart and the project scripts will be re-run from scratch.

If you need a value that will survive that, you will need to use `system.util.getGlobals()`. Take care with that, though: if you store any custom classes there, you will leak gobs of memory when you edit the origin project. Some more guidance:

> [@\[IGN-5244\]Persist Python Class Object](https://forum.inductiveautomation.com/t/ign-5244-persist-python-class-object/30498):
>
> I am working in Perspective, but this probably applies to other modules as well. I have created user defined classes in the project scripts and I am instantiating them from a view in Perspective. Is there a place I can persist the instance of the object for use between events by the user? Right now I have it serializing to a property on the view, but when I want to work with the object again I have to de-serialize the object in order to work with it again. Having to write custom de-serialize me…

---

_[View the full topic](https://forum.inductiveautomation.com/t/global-scripting-variables-library-script-top-level-vars/60516)._
