# Can I tell what scope a script is running from?

**URL:** <https://forum.inductiveautomation.com/t/can-i-tell-what-scope-a-script-is-running-from/70880>\
**Category:** Ignition\
**Tags:** perspective, vision, scripting\
**Created:** [March 10, 2023, 4:54am UTC](https://forum.inductiveautomation.com/t/can-i-tell-what-scope-a-script-is-running-from/70880 "2023-03-10T04:54:46Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Michael\_Lindon](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@Michael\_Lindon](https://forum.inductiveautomation.com/u/Michael_Lindon)\
**Post date:** [July 16, 2025, 10:45pm UTC](https://forum.inductiveautomation.com/t/can-i-tell-what-scope-a-script-is-running-from/70880/9 "2025-07-16T22:45:55Z")

</div>

This post came up in a lot in my searches and had to make adjustments to it to differentiate between whether a script was being run on the Gateway vs a Perspective Session Scope, IE whether Perspective session properties exist. Here is a quick change to the above method that solved it for me.

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

class Scope(object):
	@staticmethod
	def get():
		scope = ApplicationScope.getGlobalScope()
		if ApplicationScope.isClient(scope):
			return "c" # vision client
	
		if ApplicationScope.isDesigner(scope):
			return "d" # designer
	
		if ApplicationScope.isGateway(scope):
			try:
				system.perspective.getProjectInfo()
				return "p"
			except:
				return "g"
		return "u" # unknown

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/can-i-tell-what-scope-a-script-is-running-from/70880)._
