Suppose I have two programs: code.py and main.py. I want to call code.py in main.py. In python, we can call code.py inside main.py using the command from main import *
. Similarly, in julia suppose I have two programs: main.jl and code.jl. How can I call code.jl inside main.jl?
You need to include("code".jl")
in your main.jl. Then you can call whatever function you defined in code.jl( or use variables, etc)
If code.jl contains a module you also need to using .Mymodule
(notice the dot).
You will find extensive info about modules in:
https://docs.julialang.org/en/v1/manual/modules/#modules-1
2 Likes