Revise with nested `include`?

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.

Thanks in advance!

I noticed there was already a discussion of this in an earlier topic, sorry for a duplicate post!

If you use using Module1 instead of includet then it should work fine. includet is for quick hacks.

1 Like

Thank you! That makes sense. I will make my module into a package to make the best use of Revise.

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.

1 Like