Is there a robust way to test if a Module has already been imported? Some
modules take a very long time to load, and in some contexts it might be
nicer to check to see if the functionality is there before spending 30
seconds loading it and all its dependencies.
The naive :FooModule in names(Main) fails if I reference FooModule later in
the same namespace. I can get around that by adding another scope (like a
macro or secondary function), but that's a bit of a pain. Is there a
better way?
julia> f() = :FooModule in names(Main) && (println("has FooModule");
FooModule.bar())
f (generic function with 1 method)
julia> f()
has FooModule
ERROR: FooModule not defined
in f at none:1