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.
err($__module__, $modname, $srcfile, $srcline) do
:(const $(Symbol(modname)) = Base.require($pkg)),
$withnotifications($srcfile, $__module__, $idstr, $modname, $(esc(Expr(:quote, expr))))