# How to define a macro via Package Extension?

**URL:** <https://discourse.julialang.org/t/how-to-define-a-macro-via-package-extension/114218>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 14, 2024, 6:01am UTC](https://discourse.julialang.org/t/how-to-define-a-macro-via-package-extension/114218 "2024-05-14T06:01:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Post date:** [May 14, 2024, 7:47am UTC](https://discourse.julialang.org/t/how-to-define-a-macro-via-package-extension/114218/4 "2024-05-14T07:47:15Z")

</div>

I actually found that you can extend macros by importing them.  
`import MyPackage: @mymacro`  
you then can extend the method table of the macro by defining simply

```julia
macro mymacro(#= ... =#)
    # ...
end

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-define-a-macro-via-package-extension/114218)._
