# Vision Window opened event

**URL:** <https://forum.inductiveautomation.com/t/vision-window-opened-event/16387>\
**Category:** Ignition\
**Created:** [December 21, 2017, 10:16am UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387 "2017-12-21T10:16:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 21, 2017, 10:16am UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/1 "2017-12-21T10:16:53Z")

</div>

Hello all,

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?

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 21, 2017, 10:18am UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/2 "2017-12-21T10:18:18Z")

</div>

Just tried using the window opened event in another window with the same result.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [December 21, 2017, 11:37am UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/3 "2017-12-21T11:37:25Z")

</div>

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 `internalFrameActivated` or `internalFrameOpened` methods (depending on when exactly you want to execute the code).

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 21, 2017, 1:35pm UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/4 "2017-12-21T13:35:14Z")

</div>

Saw that, just find it odd I can’t acces the system functions on these events.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [December 21, 2017, 3:25pm UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/5 "2017-12-21T15:25:33Z")

</div>

You’ll need to put an _import system_ at the top. Window event scoping is a bit different.

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [December 21, 2017, 4:19pm UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/6 "2017-12-21T16:19:54Z")

</div>

> [@JordanCClark](#):
>
> 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).

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 22, 2017, 6:26am UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/7 "2017-12-22T06:26:56Z")

</div>

Thank you,

Having an import system works. However I am on ignition platform 7.9.5, so seems like its still required.

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [January 1, 2018, 10:13pm UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/8 "2018-01-01T22:13:37Z")

</div>

> [@Claus\_Nielsen](#):
>
> 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).

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [January 5, 2018, 9:34am UTC](https://forum.inductiveautomation.com/t/vision-window-opened-event/16387/9 "2018-01-05T09:34:23Z")

</div>

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 `shared` or `project` namespace that uses the `system` namespace without importing it also raises the exceptions statet.
