# How to tell if code is being run in global scope?

**URL:** https://discourse.julialang.org/t/how-to-tell-if-code-is-being-run-in-global-scope/92982
**Category:** General Usage
**Tags:** macros, scope
**Created:** [January 15, 2023, 5:40am UTC](https://discourse.julialang.org/t/how-to-tell-if-code-is-being-run-in-global-scope/92982 "2023-01-15T05:40:09Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)
#### Post date: [January 15, 2023, 6:13am UTC](https://discourse.julialang.org/t/how-to-tell-if-code-is-being-run-in-global-scope/92982/2 "2023-01-15T06:13:25Z")

</div>

See [https://discourse.julialang.org/t/is-there-a-way-to-determine-whether-code-is-toplevel](https://discourse.julialang.org/t/is-there-a-way-to-determine-whether-code-is-toplevel) and [https://discourse.julialang.org/t/should-macros-get-an-istoplevel-or-scope-argument](https://discourse.julialang.org/t/should-macros-get-an-istoplevel-or-scope-argument)

---

_[View the full topic](https://discourse.julialang.org/t/how-to-tell-if-code-is-being-run-in-global-scope/92982)._
