# Get the name of the invoking module

**URL:** https://discourse.julialang.org/t/get-the-name-of-the-invoking-module/22685
**Category:** General Usage
**Created:** [April 3, 2019, 10:50am UTC](https://discourse.julialang.org/t/get-the-name-of-the-invoking-module/22685 "2019-04-03T10:50:03Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [April 3, 2019, 1:57pm UTC](https://discourse.julialang.org/t/get-the-name-of-the-invoking-module/22685/7 "2019-04-03T13:57:59Z")

</div>

> [@Get module of a caller](https://discourse.julialang.org/t/get-module-of-a-caller/11445):
>
> module A foo(???) = println("I've been called from $???") end module B import A A.foo() # should pring "I've been called from B" end Is it possible to get this behavior, i.e. find out the caller’s module without requiring it to explicitly pass @\_\_MODULE\_\_? I tired: foo(; mod=@\_\_MODULE\_\_) But for obvious reasons it returns the module of foo itself instead of the caller.

But it’s not a good idea to do this. If you want to do something as intrusive as eval’ing code into a module that’s not yours then do at least require that to be explicitly passed.

---

_[View the full topic](https://discourse.julialang.org/t/get-the-name-of-the-invoking-module/22685)._
