# Getting the context in which a function is running?

**URL:** <https://forum.inductiveautomation.com/t/getting-the-context-in-which-a-function-is-running/33977>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [April 16, 2020, 12:28pm UTC](https://forum.inductiveautomation.com/t/getting-the-context-in-which-a-function-is-running/33977 "2020-04-16T12:28:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 16, 2020, 1:02pm UTC](https://forum.inductiveautomation.com/t/getting-the-context-in-which-a-function-is-running/33977/3 "2020-04-16T13:02:15Z")

</div>

However you check for scope, consider doing it at the top level of an inherited script module, setting booleans like `isDesigner` and `isGateway`. Then just check the booleans everywhere else.

Something like this:

```auto
try:
    isDesigner = bool(system.util.getSystemFlags() & system.util.DESIGNER_FLAG)
    isGateway = False
except AttributeError:
    isDesigner = False
    isGateway = True

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/getting-the-context-in-which-a-function-is-running/33977)._
