Getting started with DrWatson.jl

I’m using the scientific project managing package DrWatson which makes it easy to share code and make it run on different machines since it not only sets up a pre-designed project folder structure but also stores and activates the right Julia environment to ensure that scripts run.
Now here’s my question: The project folder system contains a “src” folder where functions are stored that are used across the project and a “scripts” folder where your various scrips for e.g. data analysis or visualisation go.
However, when I use a function from the src folder in one of my scripts, I need to compile the function first whenever I start a new session. Is there a clever/standard way to automate this?

Hi @Lucalino , welcome to the Julia discourse.
You haven’t explicitly told Julia to include your functions, so naturally you cannot find them. DrWatson on the other hand will only do automatically what you tell it to do.

The way I do it in my own project is to simply add the command:


at the start of my scripts, after quickactivate. This includes this source file in your script.

But alternative ways exist as well. For example, another thing I often do is turn my scientific project into a usable module, as explained in the documentation of DrWatson here: Real World Examples · DrWatson

This way I make a source file ProjectName.jl which has

module ProjectName



and then do

@quickactivate :ProjectName

which brings all functions from that_file.jl into scope.

This will always be true for Julia. If you restart your session you need to re-compile the functions you need to use. (pre-compilation of course decreases the time this process needs)

Thank you @Datseris! Both for the help and this neat package :smiley: