Can I tell what scope a script is running from?

This is what we do to determine scope in a script

from com.inductiveautomation.ignition.common.model import ApplicationScope

def getScope():
	scope = ApplicationScope.getGlobalScope()
	if ApplicationScope.isClient(scope):
		return "c"

	if ApplicationScope.isDesigner(scope):
		return "d"

	if ApplicationScope.isGateway(scope):
		if "perspective" in dir(system):
			return "p"
		return "g"
	return "u"
6 Likes