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

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)

What event handler is this script being called from?

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)

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.

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 :confused: