Hello dear Ignited,
I can’t wrap my head around yet simple concept. I have 30+ templates within a “bigger” template (that “bigger” template is then placed on a Main window). Inside this “bigger” template, there is also a button next to these 30+ other templates (these 30+ templates are of the same “class”).
My goal: to select all the templates from the “bigger” template and access their properties. Then, later, use it in a SQL query.
The relevant code for my attempt was as follows and this code is in a button on a template where these 30+ templates reside:
components = event.source.parent.getComponents()
for component in components:
if 'Z' == component.name[0]:
var = str(component.name)
print component.name, event.source.parent.getComponent(var).is_visible
And that gives me an error of “is_visible not being property of an object”. is_visible is a custom property of the inner template (These 30+ templates in a bigger one). However, if I use e.g. ‘Z12_note’ string inside the getComponent() instead of var, I get what I desire (i.e. value of is_visible for template in current iteration).
What am I missing here? Both var and ‘Z12_note’ are of the same type - str.
Thank you very much for your advices and opinions.
Take care.