# Indirect property reference

**URL:** <https://forum.inductiveautomation.com/t/indirect-property-reference/33646>\
**Category:** Ignition\
**Created:** [April 2, 2020, 10:28pm UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646 "2020-04-02T22:28:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [April 2, 2020, 10:28pm UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646/1 "2020-04-02T22:28:00Z")

</div>

Is there a way to do an indirect property using a nested property within another property path in an expression? This would be for read-only use and is in Perspective.

I’m using the historical playback exchange project and need to bind what would normally be indirect tags to the properties of the playback controller.

---

<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:** [April 2, 2020, 11:34pm UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646/2 "2020-04-02T23:34:10Z")

</div>

The `property` expression function? Assuming you’re asking about Perspective.

[https://docs.inductiveautomation.com/display/DOC80/property](https://docs.inductiveautomation.com/display/DOC80/property)

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [April 3, 2020, 1:23am UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646/3 "2020-04-03T01:23:21Z")

</div>

Yes! Thanks Paul.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 11, 2021, 6:41am UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646/4 "2021-07-11T06:41:09Z")

</div>

@paul-griffith  
What about in script?  
E.g. If I have a path to a session custom prop created dynamically as a string that I want to read and write to in script

`"session.custom.prop.name1"`  
How would I read this?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 12, 2021, 12:37pm UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646/5 "2021-07-12T12:37:32Z")

</div>

I think you could use `getattr(session.custom.prop, 'name1')`

[https://docs.python.org/2/library/functions.html#getattr](https://docs.python.org/2/library/functions.html#getattr)

`getattr` (_object_, _name_ [, _default_])

Return the value of the named attribute of _object_. _name_ must be a string. If the string is the name of one of the object’s attributes, the result is the value of that attribute. For example, `getattr(x, 'foobar')` is equivalent to `x.foobar`. If the named attribute does not exist, _default_ is returned if provided, otherwise [`AttributeError`](https://docs.python.org/2/library/exceptions.html#exceptions.AttributeError) is raised.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 13, 2021, 11:53pm UTC](https://forum.inductiveautomation.com/t/indirect-property-reference/33646/6 "2021-07-13T23:53:41Z")

</div>

Awesome, I had forgotten about these functions (`setattr` as well to set an attribute). Very cool and it works, just need to make sure as you said to use at least the path to `session.custom` as the attribute.

I used:

```auto
setattr(self.session.custom, self.view.params.sessionCustomPropPath, 'HELLO??')
# where
self.view.params.sessionCustomPropPath = 'path.to.custom.prop'

```

Thanks @bkarabinchak.psi !
