Currently trying to pre select a row in a Power Table using a custom property on the window opened event. Just got one issue though. I can’t use any of the
system. functions in this event. Getting errors like
AttributeError: ‘com.inductiveautomation.ignition.common.script.Imm’ object has no attribute ‘db’
AttributeError: ‘com.inductiveautomation.ignition.common.script.Imm’ object has no attribute ‘gui’
AttributeError: ‘com.inductiveautomation.ignition.common.script.Imm’ object has no attribute ‘util’
The same code running in the event works in any other event on the screen.
Is it just me doing something wrong?
Just tried using the window opened event in another window with the same result.
From the documentation on that event:
This event is fired each time the window is opened and before any bindings are evaluated.
You probably want to use one of the
internalFrameOpened methods (depending on when exactly you want to execute the code).
Saw that, just find it odd I can’t acces the system functions on these events.
You’ll need to put an import system at the top. Window event scoping is a bit different.
This would depend heavily on what version of Ignition you’re using. I’m not seeing when this was changed, but it looks like you do not have to import the system namespace for any of the window events as of at least 7.9 (I swear I’ve seen similar behavior on 7.8, but can’t remember the last time I tried on that event on a 7.8 Gateway).
For posterity, Jordan is correct in that when you see the errors in the original post, importing system would take care of the issue ( or upgrade, if possible).
Having an import system works. However I am on ignition platform 7.9.5, so seems like its still required.
I apologize for not stating it earlier, but I ran a similar test on 7.9.5, yet I didn’t seen any of the errors you reported, which makes me think I’m missing something.
Obviously this isn’t a problem for you anymore, but it would be great if you can replicate the issue and upload a project export. It seems like we should be importing the system namespace automatically so if we missed something I would like to have Development take a look at it (or at least update the documentation to reflect this use case).
Sorry for the late reply.
I will try to replicate the issue later when I get a little time on hand.
Also, noticed that using scripts in the window opened event from the
project namespace that uses the
system namespace without importing it also raises the exceptions statet.