# Check whether a macro is defined

**URL:** https://discourse.julialang.org/t/check-whether-a-macro-is-defined/85961
**Category:** General Usage
**Tags:** question, macros, metaprogramming
**Created:** [August 19, 2022, 2:27am UTC](https://discourse.julialang.org/t/check-whether-a-macro-is-defined/85961 "2022-08-19T02:27:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [August 19, 2022, 2:27am UTC](https://discourse.julialang.org/t/check-whether-a-macro-is-defined/85961/1 "2022-08-19T02:27:30Z")

</div>

I want a function (or macro) `macro_is_defined` which will return `true` if and only if the macro `SomeModule.@some_macro` is defined.

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [August 19, 2022, 2:41am UTC](https://discourse.julialang.org/t/check-whether-a-macro-is-defined/85961/2 "2022-08-19T02:41:10Z")

</div>

Does `isdefined(SomeModule, Symbol("@some_macro"))` work?
