I am having some difficulty using my own modules in my project. My approach is the following:
I start by creating a folder called MyProject and a folder src within the MyProject folder. Within MyProject/src, I generate an empty project by executing generate MyModule. So far, so good.
The content of MyProject/src/MyModule/src/MyModule.jl is
module MyModule
export greet, myfunc
greet() = print("Hello World!")
function myfunc()
print("hi from MyModule")
return nothing
end
end # module
Now, this is my module. I want to use this in MyProject, so I go back to MyProject and activate the environment: activate .
To my understanding, in order to use MyModule in MyProject, I have to include it using dev: dev src/MyModule. When I write st, I can see that MyProject now contains MyModule - so far, so good.
I now create a file playground.jl in the MyProject-folder containing the code below, which executes flawlessly:
using MyModule
MyModule.greet()
MyModule.myfunc()
Q1. Is this approach correct and professional, or am I missing something in my workflow?
Q2. When I make changes in MyModule.jl, I go to MyProject and run ]instantiate which compiles the changes, but tells me to Restart julia to access the new version. Is this really necessary, or is there a way to get the changes of MyModule.jl without having to restart? It seems a bit excessive and tedious that I have to restart Julia to test my changes.