# Getting started with DrWatson.jl

**URL:** https://discourse.julialang.org/t/getting-started-with-drwatson-jl/53339
**Category:** New to Julia
**Tags:** package, drwatson
**Created:** [January 14, 2021, 3:08pm UTC](https://discourse.julialang.org/t/getting-started-with-drwatson-jl/53339 "2021-01-14T15:08:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lucalino](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucalino/32/20983_2.png) [@Lucalino](https://discourse.julialang.org/u/Lucalino)
#### Post date: [January 14, 2021, 3:08pm UTC](https://discourse.julialang.org/t/getting-started-with-drwatson-jl/53339/1 "2021-01-14T15:08:05Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)
#### Post date: [January 14, 2021, 3:18pm UTC](https://discourse.julialang.org/t/getting-started-with-drwatson-jl/53339/2 "2021-01-14T15:18:06Z")

</div>

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:

```julia
include(srcdir("the_file_with_the_functions_you_want.jl"))

```

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](https://juliadynamics.github.io/DrWatson.jl/dev/real_world/#Making-your-project-a-usable-module-1)

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

```julia
module ProjectName

include("that_file.jl")

end

```

and then do

```julia
@quickactivate :ProjectName

```

which brings all functions from `that_file.jl` into scope.

> [@Lucalino](#):
>
> I need to compile the function first whenever I start a new session.

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)

---

<div class="post-metadata">

### Author: ![Lucalino](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucalino/32/20983_2.png) [@Lucalino](https://discourse.julialang.org/u/Lucalino)
#### Post date: [January 14, 2021, 3:25pm UTC](https://discourse.julialang.org/t/getting-started-with-drwatson-jl/53339/3 "2021-01-14T15:25:20Z")

</div>

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