Component's custom property in python class

Hello There,

I am trying to access custom property of the component in scripting but seems like I can’t access it somehow as Ignition throws attribute error.

When I do something like this, it works completely fine :

self.root = self.window.rootContainer.getComponent('PartNumberAndCompound')
for i in range(self.maximumNoOfBatches):
			self.root.getComponent('batch_number_%d'%(i)).intValue = 0

but when I try to set the custom property,
self.root.getComponent('batch_number_%d'%(i)).mixer_batch_history_id= 0
it throws following error :

Traceback (most recent call last):
  File "<event:propertyChange>", line 12, in <module>
  File "<module:shared.mixing.SAP>", line 336, in calculateWeights
AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'mixer_batch_history_id'

Is this the intended behavior ? if so, how can I access custom property ?

Thank you so much for the help in advance

There is a long-standing flaw in Vision's delivery of a PyComponentWrapper--that is, it only delivers a fully-functional component from certain component methods.

For other cases, the work-around is to install my Simulation Aids module, which inserts a jython adapter to ensure Vision components are always properly wrapped.

If you want the gory details, read this entire topic:

{ The flaw affects access to custom component methods, too. }

2 Likes

I see. I am giving it a shot.