# Is importing module is allowed inside @static?

**URL:** <https://discourse.julialang.org/t/is-importing-module-is-allowed-inside-static/28975>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 20, 2019, 2:34am UTC](https://discourse.julialang.org/t/is-importing-module-is-allowed-inside-static/28975 "2019-09-20T02:34:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [September 20, 2019, 3:32am UTC](https://discourse.julialang.org/t/is-importing-module-is-allowed-inside-static/28975/2 "2019-09-20T03:32:02Z")

</div>

Yes it is.

What you see errors for the same reason it errors without the `@static`, the macro needs to be evaluated **BEFORE** the toplevel expression (i.e. `if ...` or `@static if ...`) can run so the macro is evaluated **BEFORE** you imported the module. Repeat `if` twice, first with import and second time with the macro should work. Note that for the `import`/`using` you don’t need `@static`. You only need it for the `@sk_import` since it’s a macro.

---

_[View the full topic](https://discourse.julialang.org/t/is-importing-module-is-allowed-inside-static/28975)._
