Is there a function to query what has been imported into the current module/namespace from `export` statements in other modules?

Here’s a couple of things I have tried:

julia> using Dates

julia> names(Main)
6-element Vector{Symbol}:
 :Base
 :Core
 :Main
 :SRC
 :skipInit
 :updateLoadPath

This didn’t print anything relating to the Dates module, or any exported names from the Dates module.

I am looking for a function which shows what names/symbols are available in the current module, which happens to be Main here.

After running using Dates, I would expect such a function to print

Dates, Day, Hour, Minute, Second, etc

but not

CompoundPeriod

because if I understand correctly, that name is not exported by the Dates module.

I could be wrong about this last point.


julia> filter(name->occursin("eriod", String(name)), names(Main.Dates))
3-element Vector{Symbol}:
 :DatePeriod
 :Period
 :TimePeriod

This does not print CompoundPeriod. It seems like this might work as expected, but it’s a lot to type to query this infomation.

1 Like

It’s not in 1.11, but you will get it in 1.12, with a named usings argument to names. I.e. you can then do names(Main, usings=true).

2 Likes

Ok thank you. Useful to know about this.

:thinking: I could probably add a specialisation to about(Main) in About.jl

4 Likes