# Best methods for checking script scope

**URL:** <https://forum.inductiveautomation.com/t/best-methods-for-checking-script-scope/30201>\
**Category:** Ignition\
**Created:** [November 24, 2019, 10:32pm UTC](https://forum.inductiveautomation.com/t/best-methods-for-checking-script-scope/30201 "2019-11-24T22:32:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nicholas](https://forum.inductiveautomation.com/u/nicholas)\
**Post date:** [November 25, 2019, 4:29pm UTC](https://forum.inductiveautomation.com/t/best-methods-for-checking-script-scope/30201/2 "2019-11-25T16:29:54Z")

</div>

Try this:

```auto
	def getScope():
		"""
		Returns:
			scope (int): 0=Gateway, 1=Client, 2=Designer
		"""
		try:
			if system.util.getSystemFlags() & system.util.CLIENT_FLAG:
				location = 1
			elif system.util.getSystemFlags() & system.util.DESIGNER_FLAG:
				location = 2
		except AttributeError:
			# system.util.getSystemFlags() does not exist in gateway scope
			location = 0
		return location

```

(Source: [Which scope is my code running in?](http://forum.inductiveautomation.com/t/which-scope-is-my-code-running-in/15540/3?u=nicholas))

---

_[View the full topic](https://forum.inductiveautomation.com/t/best-methods-for-checking-script-scope/30201)._
