Create and use local module

Explaining myself:

MyModule.jl:

module MyModule
  include("./mycode.jl")
end

mycode.jl:

f(x) = x + 1

Testing:

julia> using Revise

julia> includet("./MyModule.jl")

julia> MyModule.f(1)
2

shell> vim mycode.jl # changed the behaviour of f(x) inside mycode.jl

julia> MyModule.f(1) # the change in f was not tracked
2

julia> 

I think this is an issue. Perhaps someone can explain if there is a reason for the file not being tracked, or if we should file an issue.

EDIT: According to this post:

includet is thought to track only the file itself. The workflow that is recommended is that of @ctkelley, meaning, if the module is in the current directory:

using Revise
push!(LOAD_PATH,"./")
using MyModule

Not bad. One can add this push!(LOAD_PATH,"./") to the startup.jl file and then just use the modules in the current working directory directly.

1 Like