# Pluto vs. IJulia: Including a Local Module

**URL:** https://discourse.julialang.org/t/pluto-vs-ijulia-including-a-local-module/64866
**Category:** Tooling
**Tags:** jupyter, pluto
**Created:** [July 18, 2021, 3:36pm UTC](https://discourse.julialang.org/t/pluto-vs-ijulia-including-a-local-module/64866 "2021-07-18T15:36:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![TBulka](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@TBulka](https://discourse.julialang.org/u/TBulka)
#### Post date: [July 18, 2021, 3:36pm UTC](https://discourse.julialang.org/t/pluto-vs-ijulia-including-a-local-module/64866/1 "2021-07-18T15:36:36Z")

</div>

Hello everyone,

say, I have a small directory tree like this:

```julia
+dir
|
+--subdir

```

In `subdir` I have a file `krkx.jl` which just contains a simple module:

```julia
module Krkx

export superfunc

function superfunc(x, y)
    x + y - y
end

end

```

I want to import this module from a notebook in `dir`. What puzzles me is the following behaviour: When I create a Jupyter notebook using IJulia in `dir` I can create the following cell:

```julia
include(./subdir/krkx.jl")
using .Krkx

```

This gives me the expected behaviour and I can use my new `superfunc` in subsequent cells. However, if I try to do this in Pluto I get the following error message: “ArgumentError: Package Krkx not found in current path:”

I’d very much appreciate why including and using my local file is possible in Jupyter but not in Pluto - and whether there is a way to give me this functionality in Pluto.

Kind regards,

Thomas

---

<div class="post-metadata">

### Author: ![Jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jakob](https://discourse.julialang.org/u/Jakob)
#### Post date: [July 18, 2021, 7:46pm UTC](https://discourse.julialang.org/t/pluto-vs-ijulia-including-a-local-module/64866/2 "2021-07-18T19:46:06Z")

</div>

I can’t tell you exactly why, but including files is not quite as straightforward in Pluto, presumably due to its reactivity. What should work, however, is assigning the include with the module to a variable:

```julia
Krkx=include(“./subdir/krkx.jl”)
Krkx.superfunc(1,2)

```

---

<div class="post-metadata">

### Author: ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)
#### Post date: [July 19, 2021, 9:00am UTC](https://discourse.julialang.org/t/pluto-vs-ijulia-including-a-local-module/64866/3 "2021-07-19T09:00:04Z")

</div>

Apart from the solution from @Jakob, if you really want to have access to the exported functions it seems you can do it in this hacky way:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/7/b781ff260cc1a680262b357b0c7a9823d558565b.png)

where TESTMOD.jl is only:

```julia
module TESTMOD

export hello

function hello()
	"HELLO"
end

end

```

If I am not mistaken Pluto generates a new workspace everytime you run a cell, and simply bring into the new workspaces everything you didn’t delete from previous workspaces.

The problem with the approach above is that the using would give you an error when loading the notebook and you would have to re-run the cell with some appropriate workspace number afterwards.

In general including files directly in Pluto is not recommended, you can find some more details on the discussion to [Pluto issue 115 on GH](https://github.com/fonsp/Pluto.jl/issues/115)
