Sorry for the basic beginner question but I'm really struggling with a problem concerning Julia and it's REPL.
I want to use the "MATLAB like" workflow of trying and coding at the same time. I just want to split code/functions among multiple files and combine them in a script:
include("file1.jl") # defines Module1
include("file2.jl") # defines Module2
using .Module1
using .Module2
But somehow it seems to be impossible to reload code defined in those modules without restarting the REPL. I tried using Revise.jl
and the "tracking include" includet
but it doesn't work for me.
Does someone had a similar problem and found a working solution?
This problems seems to occur frequently (e.g. here) and it's annoyance is amplified by the slow startup time / recompilation time of Julia.
Update
Ok, maybe I was a bit quick with my post on Stackoverflow. I made some experiments and now for me I discovered:
- If the
using
is avoided it works much more reliable. - Then
includet
as well asinclude
works - Especially constants are a problem and cannot be redefined once in global namespace (?)
includet
? Also, what do you mean by "it seems impossible to reload code without restarting the REPL"? What is happening, when you are changing contents offile1.jl
and executeinclude("file1.jl")
again? – Andrej Oskin