i think that results in if pageModel and pageModel.PAGE.get() is None if i remember correctly (notice the absence of not)
edit for clarity:
from com.inductiveautomation.ignition.common.model import ApplicationScope
def isPerspectiveAsync():
# https://forum.inductiveautomation.com/t/get-current-scope-in-scripting/55686/8
# https://forum.inductiveautomation.com/t/get-current-scope-in-scripting/55686/11
try:
from com.inductiveautomation.ignition.gateway import IgnitionGateway
pageModel = IgnitionGateway.get().moduleManager.resolveClass("com.inductiveautomation.perspective.gateway.model.PageModel")
return ApplicationScope.isGateway(scope) and hasattr(system,'perspective') and pageModel.PAGE.get() is None
except: return False