Hi, I have a simple question about nested include when using Revise.jl. Consider the following nested structure:
module1.jl:
module Module1
function f1()
println("abc")
end
include("module2.jl")
end
And then module2.jl:
function f2()
println("123")
end
When I do
julia> using Revise
julia> includet("module1.jl")
julia> using .Module1
I can update the function f1 by modifying module1.jl, but I cannot modify f2 via modifying module2.jl. As I understand it, it is because Revise.jl does not “penetrate” the include statement in module1.jl.
Is there an easy way around this? I suppose I can change include to includet, but that would add Revise as a dependency to Module1, when it’s otherwise unnecessary, which I would like to avoid.
Note that it’s not even necessary to make your module into a package, it’s enough to have it in a file with the module’s name ("Module1.jl"), and have your file in your LOAD_PATH.
Hello, I have the same issue, so rather than starting a new theread I continue this one…
Let’s say I have 3 files:
a.jl (the application in the real case) :
using Revise
includet("b.jl")
using .Foo
foo(1)
b.jl (the model structure in the real case) :
module Foo
using Revise
include("c.jl")
export foo
foo(y) = x + y
end
c.jl (default parameters in the real case) :
x= 3
If I use includet in b.jl I have UndefVarError: \x` not defined in `Main.Foo`but if I use justincludeinb.jlthan I can't quickly changexand see its effects when callingfoo`.
For this case I don’t want to create a package, I would like to have something self-contained in the folder that I can share with collegues (that even don’t use git).
How should I procede ? (I use VSCode if it matters)
using Pkg
Pkg.activate(@__DIR__)
using Revise
push!(LOAD_PATH,@__DIR__)
using Foo
foo(1)
It works but only if there is no ENV… if I add another package so that there is a Project/Manifest.toml, than I got an error in using Foo that Foo is not found…