Adding my module to path

I created a module MyModule and I am working on developing the test files for it. At the top of the test file, I wrote using MyModule and got an error saying Package MyModule not found in current path. I was able to rectify this by running

push!(LOAD_PATH, "C:\\Users\\Max\\MyModule")

from within Julia. This works, but the change does not persist after quitting and restarting Julia.

What do I need to do to ensure that MyModule is included in LOAD_PATH by default?

From the documentation, it looks like I need to update the JULIA_LOAD_PATH environment variable somehow. But running

(base) C:\Windows\system32>SET JULIA_LOAD_PATH="C:\Users\Max\MyModule"

from the terminal has no effect. I tried searching manually for the JULIA_LOAD_PATH variable in regedit but couldn’t find anything.

1 Like

Probably what you want to do, while developing the package, is start Julia with

julia --project

From the package directory. By doing that you will be in an environment where your package is available. No need to modify the path.

1 Like

I was able to configure this in Atom with Juno by going Juno > Settings and adding --project to Additional Julia Startup Arguments under Julia Options. Thank you!

1 Like