# Dual Window behavior issue

**URL:** <https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [September 4, 2025, 7:45pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390 "2025-09-04T19:45:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 4, 2025, 7:58pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/2 "2025-09-04T19:58:00Z")

</div>

[`system.nav.openWindowInstance`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-nav/system-nav-openWindowInstance#returns) returns a reference to the newly opened window, use that reference instead of calling `system.gui.getWindow`, like such:

```python
targetWindow = system.nav.openWindowInstance("Popup windows/Loft/DrumInspectionScreen")

```

Additionally, don't write to and then read from the same tag in the same script. Use variables to store temporary data, that's what they do. The assignment to `drumno.selectedIndex` can be simplified to `drumno.selectedIndex = value - 1`, and the call to `system.tag.readBlocking` can be removed.

Overall your code can be simplified to the following (with more descriptive names for the variables):

```python
def onDoubleClick(self, rowIndex, colIndex, value, event):
	if rowIndex == -1:
		return

	tableData = self.data
	firstColValue = tableData.getValueAt(rowIndex, 0)
	system.tag.writeAsync(["[client]ScadaNavigation/DrumSelectLime"], [firstColValue])
	newPopup = system.nav.openWindowInstance("Popup windows/Loft/DrumInspectionScreen")
	drumNoComponent = newPopup.getComponentForPath("Root Container.lbo_Drums")
	drumNoComponent.selectedIndex = firstColValue - 1

```

Side note: Pictures are great for context, but post code as preformatted text. It makes it easier for others to parse and allows copy/paste instead of trying to decipher a picture. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can edit your post by clicking the pencil icon in the bottom right.

EDIT: Added cleaned code, corrected `selectedIndex` assignment example

---

_[View the full topic](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390)._
