Thanks. I tested and this works. However, if one would like to go back to the standard environment, one needs to reactivate the standard environment again. So the complete number of commands would be:
using Pkg Pkg.activate("path/to/examples") Pkg.instantiate() include("path/to/examples/Simulate_FreeBodyRotation.jl") Pkg.activate("path/to/environments/v1.0")
When adding ModiaMath, the user does not know where ModiaMath is really installed. Therefore, to make the example completely correct, the following commands would have to be given:
using Pkg import ModiaMath Pkg.activate("$(ModiaMath.path)/examples") Pkg.instantiate() include("$(ModiaMath.path)/examples/Simulate_FreeBodyRotation.jl") Pkg.activate("path/to/environments/v1.0")
At least I understand now this (clean) approach.