# Calling getWindow from a project script

**URL:** <https://forum.inductiveautomation.com/t/calling-getwindow-from-a-project-script/20917>\
**Category:** Ignition\
**Tags:** ignition78, scripting\
**Created:** [November 17, 2018, 12:20am UTC](https://forum.inductiveautomation.com/t/calling-getwindow-from-a-project-script/20917 "2018-11-17T00:20:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 17, 2018, 12:20am UTC](https://forum.inductiveautomation.com/t/calling-getwindow-from-a-project-script/20917/1 "2018-11-17T00:20:35Z")

</div>

I’ve simplified my problem down to a test: my button calls a function in the Script Library

```
def setEnableStatus():
	import system
	print "Button pressed."
	try:
		window = system.gui.getWindow('Overview')
	except:
		print "Failed to get window."	

```

The console reports

```
Button pressed.
Failed to get window.

```

The Overview window exists in the default project location. The window is open (and the button is on it).

What am I missing? Do I need to import anything else?

---

<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:** [November 17, 2018, 12:27am UTC](https://forum.inductiveautomation.com/t/calling-getwindow-from-a-project-script/20917/2 "2018-11-17T00:27:16Z")

</div>

Try `system.gui.getOpenedWindows()` - are you sure there isn’t a trailing space or folder or something else?

---

<div class="post-metadata">

**Author:** ![Stevenson.Yuan](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@Stevenson.Yuan](https://forum.inductiveautomation.com/u/Stevenson.Yuan)\
**Post date:** [November 17, 2018, 12:28am UTC](https://forum.inductiveautomation.com/t/calling-getwindow-from-a-project-script/20917/3 "2018-11-17T00:28:31Z")

</div>

Does “Overview” exist in a folder? getWindow is expecting a path to the window. If you have a window called Overview, you can right click it and choose copy path and paste that into the script.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 17, 2018, 1:19pm UTC](https://forum.inductiveautomation.com/t/calling-getwindow-from-a-project-script/20917/4 "2018-11-17T13:19:53Z")

</div>

Thank you both. SY is correct. I was missing the path to the window. The correct syntax is

> "Main Windows/Overview"

I had read extensively through the documentation and didn't find an example of this. All refer to "Overview".  
The Copy Path will be a useful trick.
