[vision] accessing object types from custom methods

Hi everyone,

I have a root container with 8 other containers inside; each has check box components and numeric text field components.

I iterate through the root container with a for loop and check if any of my components are type "container" and contain the identifier specified in the regex. This part of my code works ok.

The problem is when I call my custom method clearLogFields, it returns the error "global name 'PMICheckBox' is not defined."

It seems like my method clearLogFields is out of scope and cannot reach the objects of type PMICheckBox and PMINumericTextField.

I also tried importing the data types and passing them as parameters of clearLogFiles but it didn't work

Anything helps, thank you all!

You just need to import them before you reference them in clearLogFields.

Try this above your for loop:

from com.inductiveautomation.factorypmi.application.components import PMICheckBox, PMINumericTextField
2 Likes

Yes, that worked!
Thank you