# 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:** 2

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [March 10, 2023, 10:13am UTC](https://forum.inductiveautomation.com/t/can-i-tell-what-scope-a-script-is-running-from/70880/2 "2023-03-10T10:13:01Z")

</div>

> [@Best methods for checking script scope](https://forum.inductiveautomation.com/t/best-methods-for-checking-script-scope/30201/2):
>
> Try this: 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))

This is 2019 so whilst perspective was out then (April 2019 = 8.0.0) it doesn't mention that scope and may need tweaked for it

---

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