# Global keywod in project scripting

**URL:** <https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [December 4, 2025, 6:54pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625 "2025-12-04T18:54:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.ruel](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@michael.ruel](https://forum.inductiveautomation.com/u/michael.ruel)\
**Post date:** [December 4, 2025, 6:54pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625/1 "2025-12-04T18:54:15Z")

</div>

I have a Vision project script that has declared a number of dictionaries using the python **global** keyword like below. I have read that it is not advised to do this in Ignition. The intent of this is to interact locally with a device and use the dictionaries to store results/send commands from within multiple areas of the project. If using the **global** keyword is not advised how would this be accomplished differently?

> global CommandResponse, CommandRequest, Status, Control, InspectionResults, InspectionParameters
> 
> # #Global kvs dictionaries
> 
> CommandResponse = {}  
> CommandRequest = {}  
> Status = {}  
> InspectionResults = {}  
> InspectionParameters = {}

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 4, 2025, 6:59pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625/2 "2025-12-04T18:59:12Z")

</div>

> **[system.util.getGlobals | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.3/appendix/scripting-functions/system-util/system-util-getGlobals)**
>
> This method returns a dictionary that provides access to the legacy global namespace.

Use `system.util.getGlobals`/`system.util.globals` to store persistent data across the entire lifetime of the local process (e.g. the local Vision client or Designer instance, or with **great care** the gateway itself).

# Be very careful to only store 'native' Python or Java data structures.

Storing user-defined Jython classes into the globals dictionary leads to memory leaks of the **entire Jython interpreter** , which will rapidly run your applications out of memory as we create and destroy script managers in the background.

---

<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 4, 2025, 6:59pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625/3 "2025-12-04T18:59:15Z")

</div>

The global keyword doesn't do what you think. And is not necessary for what you are trying to do. Variables declared at the outermost level of a project library script are automatically global to the project and persist between project saves.

---

<div class="post-metadata">

**Author:** ![michael.ruel](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@michael.ruel](https://forum.inductiveautomation.com/u/michael.ruel)\
**Post date:** [December 4, 2025, 7:14pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625/4 "2025-12-04T19:14:41Z")

</div>

That’s what I thought, so you could get rid of the first line and just go with the dictionary declaration that follows and that would be “global” to the project correct. The data stored would only persist as long as the client is open correct. The code was done by someone else and I’m trying to understand why the global keyword is needed.

---

<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 4, 2025, 7:19pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625/5 "2025-12-04T19:19:24Z")

</div>

At the top level, the global keyword is a no-op. The global keywork is intended to be used within functions (at the beginning) to make assignment to them effective instead of shadowed. Please study the python docs for this.

---

<div class="post-metadata">

**Author:** ![michael.ruel](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@michael.ruel](https://forum.inductiveautomation.com/u/michael.ruel)\
**Post date:** [December 4, 2025, 7:22pm UTC](https://forum.inductiveautomation.com/t/global-keywod-in-project-scripting/112625/6 "2025-12-04T19:22:42Z")

</div>

Paul I thought the system.util.global was for having gateway globals. In this case we just want to have a project only variable that is accessed from anywhere in the project. I’ll read the manual again.
