Are extension packages importable?

You want to export symbols that are conditionally defined based on what packages have been loaded in the session? Just checking so I understand.

You could do something like:

module Parent

export get_thingy

function get_thingy()
    ext = Base.get_extension(@__MODULE__, :Extension)
    if ext === nothing
        error("extension not loaded...")
    else
        return ext.get_thingy()
    end
end
4 Likes