# Closing popups when changing between pages

**URL:** <https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [April 5, 2024, 4:25pm UTC](https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437 "2024-04-05T16:25:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Iglesias](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Gabriel\_Iglesias](https://forum.inductiveautomation.com/u/Gabriel_Iglesias)\
**Post date:** [April 5, 2024, 4:25pm UTC](https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437/1 "2024-04-05T16:25:10Z")

</div>

I'm trying to close popups generated on one view, when I change to another one. The procedure I'm using is generating an onShutdown Event on my view, with the following code:

```auto
def runAction(self):
	messageType = 'closepopups'
	system.perspective.sendMessage(messageType, scope="page")

```

Then, on my component, I configured a message handler called 'closepopups', with the following code:

```auto
def onMessageReceived(self, payload):
	id=self.props.params.idPopup
	system.perspective.closePopup(id)

```

as the popup id is passed via a parameter. I don't see any results in the popup closing, and I suspect it is due to the onShutdown not activating.

---

<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:** [April 5, 2024, 5:26pm UTC](https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437/2 "2024-04-05T17:26:32Z")

</div>

Welcome to the forum, Gabriel. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831) and then edit your post to fix it.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 6, 2024, 8:42pm UTC](https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437/3 "2024-04-06T20:42:28Z")

</div>

The described setup worked for me. Could you please share how you're passing the param to the Popup in use?

Side note: you're shadowing a Python builtin function as a variable: `id`. I highly recommend you avoid using that variable name, along with names like `int`, `list`, or `dict`. These names all mean something in python and using them as variable names can make troubleshooting issues incredibly difficult.

![Screenshot 2024-04-06 at 1.42.20 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/6928dce326c887661b457c8c96ab5b0bb93a4902.png)

---

<div class="post-metadata">

**Author:** ![Gabriel\_Iglesias](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Gabriel\_Iglesias](https://forum.inductiveautomation.com/u/Gabriel_Iglesias)\
**Post date:** [April 8, 2024, 1:37pm UTC](https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437/4 "2024-04-08T13:37:16Z")

</div>

Thanks for your response. I think the problem is that I'm using different instances of a symbol as an embedded view. In each view of my project, I'm embedding a symbol such as a valve. Then every modification (name, popups, ...) is made to the symbol, and not each individual embedded view. I'm passing the param to the popup like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8acd360bde33f93fafc73189b4b70afe6923e1e0.png)

Then each embedded view has a different tag and a different idPopup (thanks for the variable name advice, I'm going to change that).

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 8, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/closing-popups-when-changing-between-pages/88437/5 "2024-04-08T15:08:30Z")

</div>

Two things:

1. This sort of shows me what I was looking for, but what I was really hoping to see was what the value being passed might be. The fact that this scenario works for me but not you seems to suggest that _something_ somewhere along your Popup ID passing route is not configured correctly. I highly recommend putting some temporary logging into your scripts so that you can troubleshoot

```auto
# place this in any script which writes/reads the idPopup param.
system.perspective.print("ID at point X: {0}".format(idPopupVariableNameHere))

```

1. Verify you've supplied the param to the field correctly. The Action inputs have thrown many users for loops because it _looks_ like the value is applied when it is not. Clear out your `Identifier` field, then re-select the prop to be used there, then click Apply/OK. The problem stems from users typing into the field then clicking elsewhere without pressing Enter or Tab to commit the value.
