Show a popup in perspective on all clients if a value changes

When I run the following code:

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	popupId = "O2Alarm"
	viewPath = "Split"  # insert your view path here
	logger = system.util.getLogger("POPUP")
	sessions = system.perspective.getSessionInfo()
	for session in sessions:
		for pageId in session.pageIds:
			logger.info("{0} | {1}".format(session.id, pageId))
	
			if currentValue and currentValue.value:  # I added an additional safety check for first time use here
				system.perspective.openPopup(popupId, viewPath, sessionId=session.id, pageId=pageId)
				logger.info("openPopup complete")
			else:
				# note no viewPath arg
				system.perspective.closePopup(popupId, sessionId=session.id, pageId=pageId)

I get the following logging:

POPUP	27Jun2022 08:49:51	B9B1743A | Split
POPUP	27Jun2022 08:49:51	openPopup complete
POPUP	27Jun2022 08:49:51	f456b99d-af9d-4410-94ce-39aec47272c8 | 32a9092e

Which tells me that

  1. the first page found was a browser session
  2. the popup function executed as expected (and I verified a Popup was open)
  3. A designer “page” was found (note the 8-digit identifier in use for the sessionId and View name in use for the pageId).
  4. The openPopup function did not complete the second time through because the session was a Designer.