Workflow question: loading models for simulation

Hi,

My question is related to optimization of the following workflow. I have a package MySimPkg to simulate ODE-based models and I load those models (currently julia .jl files) to run simulations. Each model.jl looks like:

function  mymodel()

# some code

return my_model_struct
end

In MySimPkg I have the following function to load models

function load_mymodel(model_jl)
  Base.include(Main, model_jl)
  return Base.invokelatest(Main.mymodel)
end

And to start simulations I run:

using MySimPkg

mod1 = load_mymodel("path_to_mymodel1")
s1 = simulate(mod1)

mod2 = load_mymodel("path_to_mymodel2")
s2 = simulate(mod2)

However include and invokelatest are time consuming procedures and it seems there could be a way to optimize this workflow. Is there better solution for this problem?

Thanks,
Ivan