# Multiple components using same pop up and message handler

**URL:** <https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 11, 2025, 2:35pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374 "2025-07-11T14:35:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_McClure](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@Brian\_McClure](https://forum.inductiveautomation.com/u/Brian_McClure)\
**Post date:** [July 11, 2025, 2:35pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/1 "2025-07-11T14:35:31Z")

</div>

Good morning, I hope everyone is well. I have a new question regarding pop ups and message handlers...I know I've asked more than a few recently haha. I've created a one line diagram for an electric distribution substation, and this one line has multiple relays on it. The relays all function similarly, and there are some controls aspects to the relays. The way it works is when the relay is clicked on a popup opens with live values and control points. When a state needs to be changed the operator clicks on the control point and a pop up opens and they have the option to toggle a boolean value, and this works well. The problem that I discovered is that if I have multiple relay popups open, the boolean state change propagates over every pop up that is open. So its obvious that I need to pass some sort of parameter that has the component name in it, and have it so that the message handler coming back from the popup is targeted to only that component. I'm just not sure how to do that. I've tried chat gpt and I can't seem to get it working just right.  
Here is the script the component has for calling the popup:

```python
def runAction(self, event):
	path = "confirmpopup52A"
	
	
	system.perspective.openPopup("confirmSelected", path,)

```

Here is the message handler on the component:

```python
def onMessageReceived(self, payload):
	
   
	if payload['confirm']:
			self.custom.confirmedSelected = True
	else:
		self.custom.confirmedSelected = False

```

And here is the script on the pushbutton inside the popup:

```python
messageType = 'toggleManual52A'

system.perspective.sendMessage(messageType,{'confirm': True}, scope = 'page')

```

I appreciate everyone's help and time with walking me through this.

---

<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:** [July 11, 2025, 2:38pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/2 "2025-07-11T14:38:02Z")

</div>

Hi, Brian. Can you see that your code formatting and indentation (essential for scripting) is messed up? 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 you can edit your post to fix each code block. Preview before posting!

---

<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:** [July 11, 2025, 2:59pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/3 "2025-07-11T14:59:39Z")

</div>

Pass the tag path to the boolean as a string parameter to the popups. Perhaps with additional params for metadata, if you don't want to use properties on the tag for that.

This is **not** a job for messages.

---

<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:** [July 11, 2025, 6:34pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/4 "2025-07-11T18:34:26Z")

</div>

Reading the [doco](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-openPopup) for the openPopup function should help

---

<div class="post-metadata">

**Author:** ![Brian\_McClure](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@Brian\_McClure](https://forum.inductiveautomation.com/u/Brian_McClure)\
**Post date:** [July 11, 2025, 6:37pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/5 "2025-07-11T18:37:57Z")

</div>

I have now, where I am passing the state of the specific relay to the popup. I put a label field in the popup that reads that state of the switch on that particular device. When clicking through I can see that is reading either true or false and that is correctly matching what the device state is. So, small victory. Now the step is when the "close" or "open" buttons are pushed, I need to I think that tag path into the params going backwards so that it only impacts the one that called it correct?

---

<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:** [July 11, 2025, 6:41pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/6 "2025-07-11T18:41:04Z")

</div>

> [@Brian\_McClure](#):
>
> I am passing the state of the specific relay to the popup

Don't do this. Just pass the tag path and let the popup use an indirect binding. Make that indirect binding bidirectional, and your popup buttons scripts just need to write to that bound property to update the tag.

Let me repeat: Do **not** snapshot live values to pass as parameters to popups or nested views.

---

<div class="post-metadata">

**Author:** ![Brian\_McClure](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@Brian\_McClure](https://forum.inductiveautomation.com/u/Brian_McClure)\
**Post date:** [July 11, 2025, 6:52pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/7 "2025-07-11T18:52:22Z")

</div>

Is my mistake here that I am using message handlers to begin with? Should I just pass the tagpath to the popup, let it do its thing, and leave it at that?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [July 11, 2025, 6:59pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/8 "2025-07-11T18:59:48Z")

</div>

> [@Brian\_McClure](#):
>
> Is my mistake here that I am using message handlers to begin with?

Yes

---

<div class="post-metadata">

**Author:** ![Brian\_McClure](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@Brian\_McClure](https://forum.inductiveautomation.com/u/Brian_McClure)\
**Post date:** [July 11, 2025, 8:43pm UTC](https://forum.inductiveautomation.com/t/multiple-components-using-same-pop-up-and-message-handler/108374/9 "2025-07-11T20:43:52Z")

</div>

Thank you guys for your help today, I was able to get it working as I was hoping. I appreciate everyone's time and energy.
