# Scripting equivalent to expression language property( ) function?

**URL:** <https://forum.inductiveautomation.com/t/scripting-equivalent-to-expression-language-property-function/116163>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [June 25, 2026, 8:41pm UTC](https://forum.inductiveautomation.com/t/scripting-equivalent-to-expression-language-property-function/116163 "2026-06-25T20:41:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![derek.ulee](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@derek.ulee](https://forum.inductiveautomation.com/u/derek.ulee)\
**Post date:** [June 25, 2026, 8:41pm UTC](https://forum.inductiveautomation.com/t/scripting-equivalent-to-expression-language-property-function/116163/1 "2026-06-25T20:41:48Z")

</div>

Working on some python scripting and trying to reference different session property values dynamically. In expression language I can just use the property( ) function and plug in whatever I want to an otherwise static path. What's the most efficient way to accomplish this in scripting?

ex. I want to access

self.session.custom.themePaths.lightMode.state.on

but I want to be able to change parts of that path. In expression language something like

property('self.session.custom.themePaths.'+{view.custom.theme}+'Mode.'+{view.custom.state})

where I can plug in any theme and state value to reference different properties. What's the easiest way in a script?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [June 25, 2026, 8:46pm UTC](https://forum.inductiveautomation.com/t/scripting-equivalent-to-expression-language-property-function/116163/2 "2026-06-25T20:46:01Z")

</div>

Perspective object type properties get a wrapper that makes them behave like a python [dict](https://docs.python.org/2.7/library/stdtypes.html#typesmapping), and the associated methods are available.

```python
self.session[dynamicKeyA][dynamicKeyB]

```

or

```python
intermediateValue = self.session.get(dynamicKeyA, fallbackA)
finalValue = intermediateValue.get(dynamicKeyB, fallbackB)

```

A direct 1-to-1 would be `self.session.custom.themePaths[self.view.custom.theme + "Mode"][self.view.custom.state]`

---

<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:** [June 25, 2026, 9:10pm UTC](https://forum.inductiveautomation.com/t/scripting-equivalent-to-expression-language-property-function/116163/3 "2026-06-25T21:10:06Z")

</div>

You can also achieve this, in the general sense, in Python via the `getattr` builtin:  
`getattr(someObjectRef, "someAttribute") == someObjectRef.someAttribute`

But for Perspective objects in particular I'd use the dictionary approach Ryan mentioned directly.
