Delaying a script with popup displayed after in Perspective

When I’ve had to do something similar, I use invokeAsynchronous like this:

# not tested in live environment - only provided as quick example of structure
def openPopupLater(sessionId, pageId):
    from time import sleep
    system.perspective.openPopup(id="DeviceReady", view="ViewToUse", sessionId=sessionId, pageId=pageId)

sessionId =
pageId =
# logic for resetting device goes somewhere before this line
system.util.invokeAsynchronous(openPopupLater, [sessionId, pageId])

It’s been explained to me that invokeAsynchronous is executed in its own thread, so you don’t risk blocking the current thread. As long as you’re not invoking this in a manner were you are sleeping on all available threads you should be fine.