I have been using Reexport.@reexport
in many of my packages and have never had an issue. At the moment, however, it is not working in one package, even though I think it is used in the same way as in my other packages.
The structure of the problematic package looks basically like this:
module MyModule
export MyType
struct MyType
end
module MySubModule
using Reexport
@reexport using ..MyModule
export MyType2
struct MyType2
end
end # MySubModule
end # MyModule
The goal here is to make all the exported symbols of the enclosing MyModule
become available when the submodule MySubModule
is used. When this works (like my other packages), I am able to do this:
julia> using MyModule.MySubModule
julia> MyType() # defined in MyModule, but still exported
However, at the moment I get
julia> MyType()
ERROR: UndefVarError: `MyType` not defined
[...]
Strangely, I can see that MyType
is available:
julia> names(MyModule)
2-element Vector{Symbol}:
:MyModule
:MyType
Also, qualifying MyType
with the module name works:
julia> MyModule.MyType()
MyModule.MyType()
In fact, If I define MyModule
as shown above, it works as intended, but the particular package I am developing is experiencing the issue described here, even though I think its structure is the same as MyModule
. Maybe I have made some trivial mistakes, but I cannot identify it.
Are there ways to understand what is causing this issue?