# Adding single-file Julia module to path in v1.0

**URL:** <https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695>\
**Category:** General Usage\
**Tags:** module\
**Created:** [August 19, 2018, 1:00am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695 "2018-08-19T01:00:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdacosta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdacosta/32/3716_2.png) [@cdacosta](https://discourse.julialang.org/u/cdacosta)\
**Post date:** [August 19, 2018, 1:00am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695/1 "2018-08-19T01:00:19Z")

</div>

I have a single-file module which I would like to add to my loading path. Previously in Julia 0.6, I had this in my `~/.bashrc`:

```bash
if [-n "$JULIA_LOAD_PATH"]; then
    export JULIA_LOAD_PATH=$MODULEPATH:${JULIA_LOAD_PATH}
else
    export JULIA_LOAD_PATH=$MODULEPATH
fi

```

If I do this in Julia 1.0, I cannot load any other modules, and Julia interprets this path as the path containing all modules, which is not what I want. So far, no matter what I try I have not managed to be able to load both my module and Base modules simply by altering an environment variable.

Any ideas?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [August 19, 2018, 1:12am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695/2 "2018-08-19T01:12:22Z")

</div>

It’s unrelated to “single-file julia module”.

> [@About "WARNING" in v0.7](https://discourse.julialang.org/t/about-warning-in-v0-7/12975/15):
>
> If there is an empty entry in LOAD\_PATH it is replaced with the default load path which is what you want here.

---

<div class="post-metadata">

**Author:** ![cdacosta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdacosta/32/3716_2.png) [@cdacosta](https://discourse.julialang.org/u/cdacosta)\
**Post date:** [August 19, 2018, 1:18am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695/3 "2018-08-19T01:18:40Z")

</div>

Sorry, could you dumb it down for me? I have seen that answer and I still don’t understand how I can fix the behavior to work in 1.0.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [August 19, 2018, 1:29am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695/4 "2018-08-19T01:29:33Z")

</div>

The issue is that the default path is overwritten.  
You need to tell julia that you still want the default.  
You do this by putting “an empty entry in LOAD\_PATH” (actually JULIA\_LOAD\_PATH).  
Entries are separated by `:` so just make sure you have an `:` at the beginning or end or a `::` in the middle.

---

<div class="post-metadata">

**Author:** ![cdacosta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdacosta/32/3716_2.png) [@cdacosta](https://discourse.julialang.org/u/cdacosta)\
**Post date:** [August 19, 2018, 2:01am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695/5 "2018-08-19T02:01:57Z")

</div>

So I should just do this, right?

```bash
if [-n "$JULIA_LOAD_PATH"]; then
    export JULIA_LOAD_PATH=$MODULEPATH:${JULIA_LOAD_PATH}:
else
    export JULIA_LOAD_PATH=$MODULEPATH:
fi

```

This seems to work!

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [August 19, 2018, 3:57am UTC](https://discourse.julialang.org/t/adding-single-file-julia-module-to-path-in-v1-0/13695/6 "2018-08-19T03:57:39Z")

</div>

Both branches do the same thing, which is why the empty path expansion works the way it does. In other words you can just do:

```julia
export JULIA_LOAD_PATH=“$MODULEPATH:$JULIA_LOAD_PATH”

```

If `JULIA_LOAD_PATH` is already set it will get spliced in, if not then the default load path will get spliced in.
