julia> module A
function foo()
s = stacktrace()
get(s[2].linfo).def.module
end
end
A
julia> module B
using A
foo() = A.foo()
end
B
julia> B.foo()
B
Obviously needs error handling, probably only works on 0.6, doesn’t quite do what you want (since it needs to be called in a function defined in B) and is generally bad since it reaches into internals, but that is at least one way to get what you want