Relative `eval`

Is it possible to use eval of the enclosing module? So if I have:

module A
    @eval x = 1

module B
    using ..A

I would like to get a handle for B inside A and pass that as the first argument to @eval. Is such a thing possible? Base.parentmodule is not what I want.

Do you mean something like:

julia> module A

julia> A.eval(:(x=1));

julia> A.x


No not really, it’s the opposite. I want to be able to evaluate expressions in Main from A if I ran using A in Main, but not just Main, any module that calls using A.

No. There’s no relation between A and B.

Ok, thanks.