I was wondering whether it is possible to define modules (or scripts)
# SomeName.jl
module SomeName
export worker()
function worker()
println( @__FILE__ )
...
return
end
and
# SomeOtherName.jl
module SomeOtherName
export worker()
function worker()
println( @__FILE__ )
...
return
end
to load them dynamically and to call their standard worker functions like
function foo()
...
modname = "SomeName" # in practice we would call something like retrievename()
mod = import( modname ) # imports the module (or includes the script)
mod.worker() # calls the worker function
end
The functionality should be similar to dynamic loading with Libdl.dlopen(), Libdl.dlsym() on LINUX or LoadLibrary(), GetProcAddress() on Windows. But I guess for Julia it may be even more elegant.
It would be interesting to learn this for both modules and scripts.