# Using system.util.getGlobals with classes

**URL:** <https://forum.inductiveautomation.com/t/using-system-util-getglobals-with-classes/78760>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [September 5, 2023, 12:38pm UTC](https://forum.inductiveautomation.com/t/using-system-util-getglobals-with-classes/78760 "2023-09-05T12:38:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 5, 2023, 1:20pm UTC](https://forum.inductiveautomation.com/t/using-system-util-getglobals-with-classes/78760/2 "2023-09-05T13:20:45Z")

</div>

If I understand correctly, you don't want to store the classes themselves in the globals dictionary because of the high risk of nasty memory leaks. You might want to store just data to the globals in the form of native objects like dictionaries and keep the logic separate.

The following links have some info on how to use the globals dictionary:

> [@Global Scripting Variables (Library Script Top-Level Vars)](https://forum.inductiveautomation.com/t/global-scripting-variables-library-script-top-level-vars/60516/8):
>
> 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/using-system-util-getglobals-with-classes/78760)._
