# ....com.inductiveautomation.ignition.common.script.Imm has no attribute "system"

**URL:** <https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [June 28, 2023, 7:33pm UTC](https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669 "2023-06-28T19:33:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jciatti](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jciatti](https://forum.inductiveautomation.com/u/jciatti)\
**Post date:** [June 28, 2023, 7:33pm UTC](https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669/1 "2023-06-28T19:33:20Z")

</div>

This error occurs only on the first load of the vision client. Following that, the error does not appear anymore, and seems to function as normal. This should be running in the vision client context, which according to the docs, is within scope. Is there something I need to be initializing first before calling this function from within the graphic?

The offending line is about mid-way down on the system.tag.readBlocking instruction.

```
def verifySecurityArea(self, event):

	roles = self.parent.Roles.split(',')
	username = self.parent.Username
	hostname = self.parent.Hostname
	clientSettings = {
		"Roles": roles,
		"User": username,
		"Hostname": hostname,
	}
	
	display_security = self.parent.DisplaySecurity
	display_security = system.dataset.toPyDataSet(display_security)
	
	area_index = event.source.Index
	
	q_value = system.tag.readBlocking("02_addons/SYS_02_nav/NavBarManager/data/Area"+str(area_index)+"_Buttons")
	button_ds = q_value.getValue()
	button_ds = system.dataset.toPyDataSet(button_ds)
	event.source.Area_Security_Valid = False
	for row in button_ds:
		display_path = row["DisplayPath"]
		for display_row in display_security:
			if display_row["DisplayPath"] == display_path:
				if self.canAccess(clientSettings, display_row):
					event.source.Area_Security_Valid = True
					break
					
		if event.source.Area_Security_Valid == True:
			break
			
	securitySettings = {
		"Roles": event.source.Roles,
		"Roles_All?": event.source.Roles_All,
		"Users": event.source.Users,
		"Users_Exclude?": event.source.Users_Exclusive,
		"Hostnames": event.source.Hostnames,
		"Hostnames_Exclude?": event.source.Hostnames_Exclusive,
	}
	event.source.Nav_Security_Valid = self.canAccess(clientSettings, securitySettings)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 28, 2023, 7:38pm UTC](https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669/2 "2023-06-28T19:38:56Z")

</div>

What event handler is this script being called from?

---

<div class="post-metadata">

**Author:** ![jciatti](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jciatti](https://forum.inductiveautomation.com/u/jciatti)\
**Post date:** [June 28, 2023, 8:41pm UTC](https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669/3 "2023-06-28T20:41:04Z")

</div>

It's a custom method within a hidden element, invoked from a different element's propertyChange event.

```
security_params = [
	"Hostnames",
	"Hostnames_Exclusive",
	"Roles",
	"Roles_All",
	"Users",
	"Users_Exclusive",
	"Initialize",
]

if event.propertyName in security_params and event.source.parent.getComponent('AreaButton0').visible:
	event.source.parent.getComponent('00_Scripts').verifySecurityArea(event)

```

---

<div class="post-metadata">

**Author:** ![jciatti](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jciatti](https://forum.inductiveautomation.com/u/jciatti)\
**Post date:** [June 28, 2023, 8:55pm UTC](https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669/4 "2023-06-28T20:55:04Z")

</div>

Hey Paul,

I think we may have found a way around for the time being. it is strange that just on the first call of this script, 'system.' seems to have no other modules, but after the first failure it works.  
We have this working if you want to close the thread, but if not, I'd be interested to see why "system" is causing this issue on first load.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 28, 2023, 9:23pm UTC](https://forum.inductiveautomation.com/t/com-inductiveautomation-ignition-common-script-imm-has-no-attribute-system/75669/5 "2023-06-28T21:23:06Z")

</div>

Well, I have somewhat more background on what's wrong but nothing on a fix. We ran into this intermittently internally and haven't yet isolated a root cause. The problem is that the component reference the custom method is attached to is failing to resolve the "proper" system library, so you get this pretty much useless half baked one (instead of an outright exception that it couldn't find the system library). But there's literally about five ways it tries to find the system library before it creates one from scratch, and we have no easy way of telling why all of those are failing without reliable reproduction steps 😕
