Refer to a function in enclosing module

You need to pull f into SubA from A like so:

julia> module A
       f(x) = 10*x

       module SubA
       using ..A: f

       g(x)  = f(1)

       end

       end
Main.A

julia> using .A

julia> A.SubA.g(3)
10

the ..A basically means $EnclosingModule.A like in unixy directories.

3 Likes