I’d like to import symbols from a submodule without fully qualifying the module. Like this
import TestPackage.InnerMod
import InnerMod: inner_a # or import InnerMod.a
But that gives me ArgumentError: Package InnerMod not found in current path
Note that import TestPackage.InnerMod: inner_a
works. But in some situations this can be quite verbose.
The following also fails.
import TestPackage as TP
import TP.InnerMod: inner_a # fails
import TP.InnerMod.inner_a # fails
The alias TP is not a perfect standin for the full name.
I suppose I could write a macro. Maybe there is already a package to do this?
By the way, splitting the package into separate packages is not a good option in the cases I am thinking of.
Here is the file I used to do the tests above:
module TestPackage
module InnerMod
const inner_a = 2
end # module InnerMod
end # module TestPackage