Open a popup for a specific session from a custom session variable

I have a custom session variable tied to a PLC tag dynamically.

When the tag is enabled (True) I want to open a popup on that specific client.

However, the script shown in the window, line 4, is unable to find a specific page.

system.perspective.openPopup(self.props.id, 'PopUps/MachineStopped', params = {}, showCloseIcon = False, resizable = True, pageID = '/dashboard')

I think I am possibly calling the session ID wrong but am not sure. Does anyone know the proper syntax to make this work?

It is not enough to have a session scope, as that can have multiple pages, or even zero pages (when a user closes a tab, and before the session timeout).

If you want the popup on all tabs of the session, you must iterate through the session's pages and make that call with the specific page IDs.

If tabs are to behave separately (indirect tag?), then you should move the tag binding and script to a docked view's custom properties. That will have page scope.

Yes, of course. Makes sense.

I wanted to only open a popup on that specific session.

I moved the tag change script to the exact page where I want the popup to take place and it works now.

system.perspective.openPopup(self.session.props.id, view='Popups/MachineStopped')

Example of what is going on:
There are 10 machines on the floor. There is a PLC controlling all 10 machines and I made 10 custom PLC tags. When PLC tag for machine 1 goes "true" I want a popup to appear on machine 1. This is now working as expected. The customer is running 10 perspective sessions like they would run 10 vision clients. The sessions will always be available and there is only 1 default page being shown on a session.