Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load a local module in Julia

Tags:

julia

I've written a module in Julia using PkgTemplates package. The module is saved in C:/Users/me/.julia/dev/MyModule folder.

I cannot load the module in other sessions. I've tried push!(LOAD_PATH, path) but didn't work.

Only include("C:/Users/me/dev/MyModule/src/MyModule.jl") works but in this case I can only use the functions in the module using MyModule.myfunction().

I couldn't find any other way to load the module.

like image 305
ilker_arslan Avatar asked Oct 27 '25 10:10

ilker_arslan


1 Answers

You should use Pkg.develop (or pkg> develop in the Pkg REPL mode), see https://julialang.github.io/Pkg.jl/v1/managing-packages/#Adding-a-local-package-1. Pkg.develop is basically Pkg.add but you install from a local path, for example

julia> using Pkg

julia> Pkg.develop(PackageSpec(path = "C:/Users/me/dev/MyModule"))

or in the REPL mode:

pkg> develop C:/Users/me/dev/MyModule
like image 125
fredrikekre Avatar answered Oct 29 '25 09:10

fredrikekre