# visionWindowOpened Script Not Running

**URL:** <https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [April 24, 2024, 2:34pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364 "2024-04-24T14:34:46Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 2:34pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/1 "2024-04-24T14:34:46Z")

</div>

I have a script on a docked window's open event handler that doesn't seem to be running. The window is set to open on startup.

I have a logger set up for diagnostics as well, but none of the logging info is in the gateway status logs, which leads me to believe that the script isn't running for some reason.

logger set up in the Navigation script library:

```python
#set up navigation logger
logger = system.util.getLogger('Navigation')

```

From the first line of the `visionWindowOpened` script on the docked window:

```python
Navigation.logger.info('Nav Dock Opened.')

```

But I see no such entry in the log when I launch a client.

---

<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:** [April 24, 2024, 2:36pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/2 "2024-04-24T14:36:34Z")

</div>

Logger statements don't automatically go to the gateway; you're just creating a logger in the local scope:

> [@Event Configuration Print Out to debug](https://forum.inductiveautomation.com/t/event-configuration-print-out-to-debug/60091/5):
>
> It’s complicated slight_smile Starting from most local to least… In the script console, print will log directly to the output buffer on the right hand side. system.util.getLogger() will log to the named ‘Output Console’ Designer window. Bonus: A script invoked from here using system.util.invokeAsync will print to the regular output console, not the buffer on the right hand side. Anywhere else in the designer (except Perspective), print and system.util.getLogger will log to the ‘Out…

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 24, 2024, 2:38pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/3 "2024-04-24T14:38:51Z")

</div>

Also, why are you doing

```python
Navigation.logger.info('Nav Dock Opened.')

```

your logger is bound to the variable `logger`, so wouldn't it be

```python
logger.info('Nav Dock Opened.')

```

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 3:39pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/4 "2024-04-24T15:39:32Z")

</div>

logger exists in the scope of the Navigation script library

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 3:46pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/5 "2024-04-24T15:46:16Z")

</div>

So I created a logger in the scope of a script library. Where would it go, or how do I get it to the gateway status log? I didn't see a case for a script executing in the client scope.

---

<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:** [April 24, 2024, 3:53pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/6 "2024-04-24T15:53:08Z")

</div>

The project script library doesn't have a scope. It's just a library. The scope of anything used there is the scope of the event that calls into that library.

Vision clients log locally, visible only in their local diagnostics (via the help menu). Same with the designer. Only code that runs in the gateway itself will log to the gateway logs.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 3:53pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/7 "2024-04-24T15:53:58Z")

</div>

Is there a keyboard shortcut to open that? I have it disabled

---

<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:** [April 24, 2024, 3:54pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/8 "2024-04-24T15:54:06Z")

</div>

Ctrl + Shift + F7.

Alternately, for posterity:

> **[system.gui.openDiagnostics | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-gui/system-gui-openDiagnostics)**
>
> Opens the client runtime diagnostics window, which provides information regarding performance, logging, active threads, connection status, and the console.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 3:56pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/9 "2024-04-24T15:56:23Z")

</div>

How about opening on a button press?

edit: beat me to it 😅

---

<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:** [April 24, 2024, 4:00pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/10 "2024-04-24T16:00:47Z")

</div>

It would be nice if that page also **stated** what the keyboard shortcut is.

This topic doesn't mention the Vision client at all:

> **[Windows, Linux, and Mac Keyboard Shortcuts | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/designer/windows-linux-and-mac-keyboard-shortcuts)**
>
> Using Keyboard Shortcuts in the Designer

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 4:10pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/11 "2024-04-24T16:10:56Z")

</div>

So, other than the logger not logging where expected, the script is running, but it's running _too early_?

The window open is supposed to fire a script that swaps to a window and updates a property on the docked window, but that property on the docked window is not updating

---

<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:** [April 24, 2024, 4:12pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/12 "2024-04-24T16:12:47Z")

</div>

> [@amarks](#):
>
> it's running _too early_?

Yes, window open is documented to run before bindings run. It also **doesn't** run again if a window is cached and re-opened. it is almost never the "right" place to put anything.

Is this the window that auto-opens on project start? If so, make no window auto-open at all, and provide precise initial actions in a client startup event instead.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [April 24, 2024, 4:25pm UTC](https://forum.inductiveautomation.com/t/visionwindowopened-script-not-running/89364/13 "2024-04-24T16:25:09Z")

</div>

🙃 turns out my script only wrote one of the two properties I was expecting it to. We'll see if that fixes it 😅

It works as expected after fixing the script
