Indirect property reference

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.

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

Yes! Thanks Paul.

1 Like

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

How would I read this?

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

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 is raised.


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:

setattr(self.session.custom, self.view.params.sessionCustomPropPath, 'HELLO??')
# where
self.view.params.sessionCustomPropPath = ''

Thanks @bkarabinchak.psi !

1 Like