# Is it possible to access window components from the project library scripts?

**URL:** <https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781>\
**Category:** Ignition\
**Created:** [November 21, 2022, 9:36pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781 "2022-11-21T21:36:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahman.tarek](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@rahman.tarek](https://forum.inductiveautomation.com/u/rahman.tarek)\
**Post date:** [November 21, 2022, 9:36pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/1 "2022-11-21T21:36:44Z")

</div>

1. I have a window called 'operator\_controller' and im trying to run a function in one of my charts (image 1)  

2. To call that function im using the code in the second image. This is code is located in the Project Library scripts  

But i get this error:

Error executing script.  
Traceback (most recent call last):  
File "tagevent:alarmActive", line 3, in alarmActive  
File "module:GlobalScripts", line 188, in alarmact  
AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'gui'

So its basically saying system.gui does not work in the project library scripts? is there another way to do this?

Thanks

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 21, 2022, 9:42pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/2 "2022-11-21T21:42:31Z")

</div>

But what is calling the project library function in (2)? i.e. what is calling "alarmActive"? Looks like this is coming from a tag change event? in which case this is running in the gateway scope which doesn't know about Vision, hence no gui functions will work

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 21, 2022, 9:57pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/3 "2022-11-21T21:57:26Z")

</div>

Expanding on this:

> [@rahman.tarek](#):
>
> So its basically saying system.gui does not work in the project library scripts?

They can, under some circumstances. It isn't whether you are calling from a project script, but what ultimately _ **called** _ the project script. Project scripts are present in gateway scope (by project), designer scope, Vision client scope, and Perspective scope (a variant of gateway scope). But the contents of the _ **system** _ library varies by calling scope.

Interacting with other execution _ **scopes** _ involves **messaging**. Project scripts are **not** a **scope** in and of themselves.

The `system.gui.*` and `system.nav.*` functions exist in Vision Client scope, and Designer scope when Vision is installed.

---

<div class="post-metadata">

**Author:** ![rahman.tarek](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@rahman.tarek](https://forum.inductiveautomation.com/u/rahman.tarek)\
**Post date:** [November 21, 2022, 11:14pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/4 "2022-11-21T23:14:43Z")

</div>

yes ure right. a tag change event is calling the project library function.  
how do you propose i do this then?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 21, 2022, 11:26pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/5 "2022-11-21T23:26:12Z")

</div>

You need to monitor that alarm tag (`.../Alarm tags/Alarm Active`) in the clients e.g. in a Vision Client Tag, and open your popup from there, assuming I'm interpreting what you're trying to do correctly. I.e. open a popup when an alarm activates (you haven't given _any_ detail about what you're actually trying to achieve)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 22, 2022, 1:04am UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/6 "2022-11-22T01:04:04Z")

</div>

> [@nminchin](#):
>
> in a Vision Client Tag

Not necessary. A Vision Client Tag Change **Event** would suffice.

> [@rahman.tarek](#):
>
> a tag change event is calling

You don't. Or more precisely, not from gateway scope.

You write your script to run in some client scope, Vision or Perspective. See this related discussion:

> [@Automatic Function](https://forum.inductiveautomation.com/t/automatic-function/66619/16):
>
> Aside from the style customizer, which is a Vision thing, the key to the question is to use an expression binding to translate your tag values into a range of colors or indices for colors. Whether Vision or Perspective. I highly recommend you bind the source tag to a custom property (perhaps indirectly), and then use that property in your expressions or styling. Note that one "pulls" the tag into the UI for evaluation--you don't "push" from the tag to the UI. That is, don't try to do this so…

Note especially how your UI should _ **pull** _ the data it needs from global resources, including tags, not have those resources try to _ **push** _ to the UI.

---

<div class="post-metadata">

**Author:** ![rahman.tarek](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@rahman.tarek](https://forum.inductiveautomation.com/u/rahman.tarek)\
**Post date:** [November 22, 2022, 4:10am UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/7 "2022-11-22T04:10:56Z")

</div>

im trying to open a popup when an alarm is active. the system.gui functions dont work from a tag change event either

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 22, 2022, 4:49am UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/8 "2022-11-22T04:49:42Z")

</div>

> [@pturmel](#):
>
> Not necessary. A Vision Client Tag Change **Event** would suffice.

Ah yes, I forgot about those... Perspective is replacing my Vision memory!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 22, 2022, 1:13pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-access-window-components-from-the-project-library-scripts/66781/9 "2022-11-22T13:13:05Z")

</div>

> [@rahman.tarek](#):
>
> im trying to open a popup when an alarm is active

Put this code in a client-scoped tag change event (not on the tag, but in the Vision section of the designer tree).
