# Change Session Properties By Reference

**URL:** <https://forum.inductiveautomation.com/t/change-session-properties-by-reference/93881>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [July 30, 2024, 2:33am UTC](https://forum.inductiveautomation.com/t/change-session-properties-by-reference/93881 "2024-07-30T02:33:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![csjohnson](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@csjohnson](https://forum.inductiveautomation.com/u/csjohnson)\
**Post date:** [July 30, 2024, 2:33am UTC](https://forum.inductiveautomation.com/t/change-session-properties-by-reference/93881/1 "2024-07-30T02:33:03Z")

</div>

Ignition v8.1.35

Curious to know of any pitfalls with my project.  
This alludes from one of my last questions about class instances.

I have a working project and the way I did it is as follows.  
There are many sessions each with the same custom properties defined, with each property value being set by a session’s respective memory tags on session start.

I have an “admin dashboard” where a user can change the value of an online session’s custom property value from a table.

Instead of messaging the target session of the change, I write the change to a saved reference of the target session. On session startup, it will log itself to a dictionary defined globally in project script. When a user needs to change a value in a session, it just changes the value stored in the dictionary for the respective key.  
I created a class that takes the session as an argument and use property getters/setters for modifying the `session.custom` values.

While this does work, it doesn’t “feel” correct.  
That is, relying on the value change propagating to the source object by reference only. It seems a message handler should handle/marshall change requests to the required session. Thoughts?

---

<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:** [July 30, 2024, 11:36am UTC](https://forum.inductiveautomation.com/t/change-session-properties-by-reference/93881/2 "2024-07-30T11:36:09Z")

</div>

How are you clearing sessions from this project library dictionary? That would be my concern--memory leakage.

You might be interested in my `sessionVarMap()` function(s) of my Integration Toolkit.

---

<div class="post-metadata">

**Author:** ![csjohnson](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@csjohnson](https://forum.inductiveautomation.com/u/csjohnson)\
**Post date:** [July 30, 2024, 11:52am UTC](https://forum.inductiveautomation.com/t/change-session-properties-by-reference/93881/3 "2024-07-30T11:52:13Z")

</div>

The dictionary is redefined anytime gateway scripts restart. The perspective sessions are added back on session startup or manually by user interaction.  
When a session closes, it removes itself from the dictionary.

I will take a look at your module.
