julia> module A
foo() = 42
end
Main.A
julia> module B
import ..A # Would be simply `import A` if A were in the load path rather than in Main
const foo = A.foo
export foo
end
Main.B
julia> using .B
julia> foo()
42
Note that this is better than the alternative of import A: foo; export foo because it allows tab completion of A.<TAB> to work. (A binding must not be marked as imported-from-another-module for tab completion to consider it.)
Thank you for your answer. However, I would like to export all symbols exported by A (like what could be done by @reexport import A if Reexport were to support this syntax). With your solution, this would mean doing import A; const foo = A.foo for all symbols exported by A which is equivalent to using A. Is it possible to do it without making the symbols of A accessible inside module B ?
Why do you want to do this? It seems a little odd to decide that the user wants those symbols after doing using B, even though they’re never available within B.
Looking at the code, I think there’s no way to “export without import” because using brings in bindings from the source module which have the exportp flag set: