# \[vision\] accessing object types from custom methods

**URL:** <https://forum.inductiveautomation.com/t/vision-accessing-object-types-from-custom-methods/74465>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [June 1, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/vision-accessing-object-types-from-custom-methods/74465 "2023-06-01T20:03:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fbrinneman](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbrinneman](https://forum.inductiveautomation.com/u/fbrinneman)\
**Post date:** [June 1, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/vision-accessing-object-types-from-custom-methods/74465/1 "2023-06-01T20:03:08Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/f/3f321d7889734e4d173f41e35bdd2c4e94dfd36d.png)

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/732b7abecc46121eaec3202ea073ca486e8b3482.png)

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!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 1, 2023, 8:05pm UTC](https://forum.inductiveautomation.com/t/vision-accessing-object-types-from-custom-methods/74465/2 "2023-06-01T20:05:46Z")

</div>

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

Try this above your for loop:

```auto
from com.inductiveautomation.factorypmi.application.components import PMICheckBox, PMINumericTextField

```

---

<div class="post-metadata">

**Author:** ![fbrinneman](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbrinneman](https://forum.inductiveautomation.com/u/fbrinneman)\
**Post date:** [June 1, 2023, 8:34pm UTC](https://forum.inductiveautomation.com/t/vision-accessing-object-types-from-custom-methods/74465/3 "2023-06-01T20:34:40Z")

</div>

Yes, that worked!  
Thank you
