Creating a property in Python Script

Hello!

I would like to ask if it is possible to create a property in a component using a Python Script behaviour?

Currently in my script, I created a variable that saves every CycleTimer as a total (int), I want to later display this total in the Statistics function and to be able to later, export it as an Excel file. I am aware that we first have to create a property for the Statistics function to know which property to listen to, which is where I am currently stuck at.

Thank you very much, this community had helped me a whole lot so far!

Hi @Thenolypus,

You can create a new property to a component with the createProperty() method. Example below:

comp = getComponent()
new_prop = comp.createProperty(VC_INTEGER, 'NewIntegerPropertyName')
new_prop.Value = 150

There is also an Academy tutorial that goes through the basics: Create Properties with Constraints | Visual Components Academy
See the Help file for detailed information under vcComponent.

-Este