# How to reload a newly created package

**URL:** <https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566>\
**Category:** General Usage\
**Tags:** package\
**Created:** [February 8, 2019, 12:27am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566 "2019-02-08T00:27:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [February 8, 2019, 12:27am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566/1 "2019-02-08T00:27:43Z")

</div>

I created a new package following the documentation. Specifically, I am stuck on [this section](https://julialang.github.io/Pkg.jl/latest/creating-packages/#Adding-dependencies-to-the-project-1) where it says “and reloading the package…”. I cannot reload the package after restarting the REPL. If I did not screw something up, there probably is something missing in the documentation.

First I generate my package:

```julia
(v1.0) pkg> generate Thyrosim
Generating project Thyrosim:
    Thyrosim/Project.toml
    Thyrosim/src/Thyrosim.jl

```

Change directory to the package:

```julia
shell> cd Thyrosim/
/Users/biona001/.julia/dev/Thyrosim

```

Activate the package and import:

```julia
(v1.0) pkg> activate .
julia> import Thyrosim
[Info: Precompiling Thyrosim [7ef34fca-2b35-11e9-1aeb-a527bedb189e]

julia> Thyrosim.greet()
Hello World!

```

Exit Julia and try to use it again:

```julia
julia> exit()
$ julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.0.3 (2018-12-18)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> using Thyrosim
ERROR: ArgumentError: Package Thyrosim not found in current path:
- Run `import Pkg; Pkg.add("Thyrosim")` to install the Thyrosim package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:823

julia> import Thyrosim
ERROR: ArgumentError: Package Thyrosim not found in current path:
- Run `import Pkg; Pkg.add("Thyrosim")` to install the Thyrosim package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:823

```

How do I begin using my newly generated package?

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [February 8, 2019, 12:37am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566/2 "2019-02-08T00:37:45Z")

</div>

You have to re-run `activate Thyrosim` when you restart the REPL.

I recommend reading the new `Pkg` quickstart: [2. Getting Started · Pkg.jl](https://julialang.github.io/Pkg.jl/dev/getting-started/). It might make the “environments” workflow more clear.

---

<div class="post-metadata">

**Author:** ![eliassno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eliassno/32/18917_2.png) [@eliassno](https://discourse.julialang.org/u/eliassno)\
**Post date:** [February 8, 2019, 12:54am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566/3 "2019-02-08T00:54:44Z")

</div>

The package is only available in the `activate`d project’s environment.

You’ll have to `activate` the same environment each time you restart Julia, to access `add`ed packages.

You could also [add your local package](https://julialang.github.io/Pkg.jl/latest/managing-packages/#Adding-a-local-package-1) to the default environment `(v1.0)`.

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [February 8, 2019, 1:15am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566/4 "2019-02-08T01:15:33Z")

</div>

> [@eliassno](#):
>
> You could also [add your local package](https://julialang.github.io/Pkg.jl/latest/managing-packages/#Adding-a-local-package-1) to the default environment `(v1.0)` .

This is good advice if you need a package available by default. But keep in mind that `add` will track a project through `git`. This adds a layer of indirection that can be confusing.

A simpler alternative is to use `develop` instead of `add`. `develop` will load a project’s source code directly as it exists on the filesystem.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 8, 2019, 4:31am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566/5 "2019-02-08T04:31:33Z")

</div>

You can also launch julia with the `--project` flag, which is equivalent to doing `pkg> activate .`

---

<div class="post-metadata">

**Author:** ![anon67531922](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon67531922](https://discourse.julialang.org/u/anon67531922)\
**Post date:** [February 8, 2019, 4:37am UTC](https://discourse.julialang.org/t/how-to-reload-a-newly-created-package/20566/6 "2019-02-08T04:37:52Z")

</div>

I put the following in `.julia/config/startup.jl`:

```julia
using Pkg
Pkg.activate("path/to/my/package")

```

This is convenient for me on Windows because I don’t start Julia from the command line. I double click the icon 😅
