"No perspective page attached to this thread" when trying to openPopup from Session custom property change

For Perspective to open a Popup, it needs to know what Page to open the Popup on. In most places within Perspective, the triggers are from components, which by definition are already part of a Page. Session properties are NOT part of a page, and so even though they are part of a session, there is no direction as to which page they should open on.

That’s why your call is not working. The warning is telling you that the thread on the Gateway which is executing your script has no context as to which page it should open the Popup on. Suppose an active session has five tabs open when this script executes; which tab should the Popup open on?

Workarounds:

  1. (recommended) I’m betting that you actually only want this Popup opened on a single one of your pages, so I would bind a custom property on the root of that View to the session property, and then place your change script on the custom root property instead of the session property. Doing this would result in the popup being opened just as if the change script had been on the session property, but now you will definitely have a Perspective page attached to the thread.

  2. If you absolutely must use a session property to open a Popup, then you have access to the session through the supplied self argument. The following should get you what you need, although it will open a Popup on EVERY page in the session.

for pageId in self.info.pageIds:
    # note that the following call is actually supplying a pageId argument.
    system.perspective.openPopup(‘fgFgdI8a’, ‘Page/Popups/Recordatorios/TM_Remainder’, pageId=pageId)