Relative `eval`

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

module A
    @eval x = 1
end

module B
    using ..A
end

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
       end
Main.A

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

julia> A.x
1

?

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.