the module PyCall will be loaded, even if you haven’t run using .MyModule.
The main question is: Is it possible to delay this load of dependencies to the time when you run using MyModule? and if possible, Is there an apparent reason for this to be a bad idea?
Thanks @mkitti for your eager response, but I think that the package provided does not cover the use case I’m looking for.
I understand that Requires allows to trigger the execution of portions of code (such as using (...) ) after some other package is also loaded. What I want is to run portions of code after the module itself is loaded, which is subtly different, and (I think) is not covered.
You may want to take a close look at how Requires.jl works and examine thr consequences for precompilation and static compilation.
if !isprecompiling()
listenpkg($pkg) do
withpath($srcfile) do
err($__module__, $modname, $srcfile, $srcline) do
$(esc(:(eval($(Expr(:quote, Expr(:block,
:(const $(Symbol(modname)) = Base.require($pkg)),
expr)))))))
end
end
$withnotifications($srcfile, $__module__, $idstr, $modname, $(esc(Expr(:quote, expr))))
end
end