# Developing and using my own code

**URL:** <https://discourse.julialang.org/t/developing-and-using-my-own-code/18372>\
**Category:** General Usage\
**Created:** [December 6, 2018, 12:25pm UTC](https://discourse.julialang.org/t/developing-and-using-my-own-code/18372 "2018-12-06T12:25:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidavdav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidavdav/32/1065_2.png) [@davidavdav](https://discourse.julialang.org/u/davidavdav)\
**Post date:** [December 6, 2018, 12:25pm UTC](https://discourse.julialang.org/t/developing-and-using-my-own-code/18372/1 "2018-12-06T12:25:57Z")

</div>

Hello,

Since julia 1.0 I am completely lost with how the packaging system works in terms of dealing with my own code. I’ve read [Pkg · The Julia Language](https://docs.julialang.org/en/v1/stdlib/Pkg/index.html) over and over again, and I just don’t get it.

Suppose I have some local package in `~/julia/Mod1.jl/`, that I am actively developing/debugging, and I basically want to use it in some application in `~/julia/Mod2.jl/`. How do I use the `pkg>` julia-shell commands `dev`, `activate` and `instantiate` and perhaps a couple of other commands while working in `~/julia/Mod1.jl/` so that I have access to the current actual code on disk in `~/julia/Mod1.jl/` while working on the application in `~/julia/Mod2.jl/`? And what do I need to do in in the REPL in `~/julia/Mod2.jl/` in order to reload the code in `~/julia/Mod1.jl/`?

Thanks,

—david

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [December 6, 2018, 7:11pm UTC](https://discourse.julialang.org/t/developing-and-using-my-own-code/18372/2 "2018-12-06T19:11:09Z")

</div>

I believe the following should work iiuc:

1. Move your `~/julia/Mod1.jl` and `~/julia/Mod2.jl` files to `~/julia/Mod1/src` and `~/julia/Mod2/src` folders respectively.
2. Turn your `Mod1` folder into a package with Project.toml and Manifest.toml files using the instructions in [Convert REQUIRE to Project.toml and Manifest.toml - #2 by mohamed82008](https://discourse.julialang.org/t/convert-require-to-project-toml-and-manifest-toml/17775/2)
3. Follow similar steps for `Mod2` but before step 10, you can do `]add ~/julia/Mod1` which will add `Mod1` as a local dependency of `Mod2`.
4. After you restart Julia in the default environment, make both packages visible in this environment by running `]dev ~/julia/Mod1` and `]dev ~/julia/Mod2`, or you can choose to make the latter only visible if you want.

Hopefully, some expert can correct me if I said anything wrong.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [December 6, 2018, 7:58pm UTC](https://discourse.julialang.org/t/developing-and-using-my-own-code/18372/3 "2018-12-06T19:58:52Z")

</div>

To add `Mod1` as a dependence of `Mod2`, you probably want to `dev ~/julia/Mod1` instead of `add ...`, because `add` will only track the changes you commit to `Mod1`. Also it is probably cleaner to use relative path, `dev ../Mod1`.
