# Creating package with PkgTemplate: Stuck following video tutorial

**URL:** <https://discourse.julialang.org/t/creating-package-with-pkgtemplate-stuck-following-video-tutorial/41572>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [June 17, 2020, 2:40am UTC](https://discourse.julialang.org/t/creating-package-with-pkgtemplate-stuck-following-video-tutorial/41572 "2020-06-17T02:40:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davida/32/16174_2.png) [@DavidA](https://discourse.julialang.org/u/DavidA)\
**Post date:** [June 17, 2020, 2:40am UTC](https://discourse.julialang.org/t/creating-package-with-pkgtemplate-stuck-following-video-tutorial/41572/1 "2020-06-17T02:40:34Z")

</div>

I’m following [this video (Developing Julia Packages)](https://www.youtube.com/watch?v=QVmU29rCjaA) and I’m getting stuck when doing `using MyExample` in my `runtests.jl` file in the test folder (around 8m30s onwards in the video).

I’m using Mac so the file structure is slightly different but otherwise I have followed all the steps. I think only 2 differences in the setup between me and the video.  
1: I put the package folder in `./julia/dev` (I had to create the `dev` folder but `.julia` was already there).  
2: When I run `generate("MyExample", t)` there is a warning that unrecognised keywords were supplied (relating to `license="MIT"`) and a warning that `generate("MyExample", t)` is deprecated and I should use `t("MyExample")` instead. (This is after running `t = Template(; ... )`)

Everything appears to be in place in the folder on my computer and in the GitHub repository. In my `src` folder I have two files as in the video, `myExample.jl` with contents

```julia
module MyExample

# Write your package code here.

include("extra_file.jl")

end

```

and `extra_file.jl` with contents

```julia
my_f(x,y) = 2x+y

```

In the `test` folder I have the file `runtests.jl` with contents

```julia
using MyExample
using Test

my_f(2,1)

@testset "MyExample.jl" begin
    my_f(2,1)
end

```

If I do cmd+enter on the line `my_f(x,y)=2x+y` in `extra_file.jl` then I can do cmd+enter on `my_f(2,1)` in `runtests.jl` and the little popup has a 5 in it. But if I try to cmd+enter `using MyExample` in `run_tests.jl`, I get an error message in the popup `ArgumentError: Package MyExample not found in current path`. Doing cmd+enter on `using Test` works. I don’t think the video does anything path related so I’m not sure what to do here.

I also tried `using .MyExample` in `runtests.jl` which didn’t work (the error is `UndefVarError: MyExample not defined`).

If I run `MyExample.jl` in `src` then I can do `using .MyExample` but this is quite different to what is done in the video (the dot isn’t used and the file is not executed). Doing `using MyExample` after running `MyExample.jl` does not work.

If I restart the Julia process in the REPL then again doing cmd+enter on `using MyExample` gives the same `ArgumentError` as previously.

I can’t work out what is happening here. The only logical thing I can think of is a path issue but I don’t think I have done anything with my Julia path and the video doesn’t mention anything to with path either. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![grahamstark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/grahamstark/32/5200_2.png) [@grahamstark](https://discourse.julialang.org/u/grahamstark)\
**Post date:** [June 17, 2020, 5:58am UTC](https://discourse.julialang.org/t/creating-package-with-pkgtemplate-stuck-following-video-tutorial/41572/2 "2020-06-17T05:58:00Z")

</div>

As someone who has recently struggled with all this myself, I feel for you.

I think the missing step here is activating the package. In the repl, type `]` to go into package mode and then type:

```julia

activate ~/.julia/dev/MyExample

```

tests should then work. Replace `~/.julia/dev/MyExample` as needed, of course.

That’s an excellent video but it’s easy to miss steps following along a video - I certainly did.

Graham

---

<div class="post-metadata">

**Author:** ![DavidA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davida/32/16174_2.png) [@DavidA](https://discourse.julialang.org/u/DavidA)\
**Post date:** [June 17, 2020, 6:41am UTC](https://discourse.julialang.org/t/creating-package-with-pkgtemplate-stuck-following-video-tutorial/41572/3 "2020-06-17T06:41:40Z")

</div>

That was it, thank you!

---

<div class="post-metadata">

**Author:** ![jo-fleck](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jo-fleck](https://discourse.julialang.org/u/jo-fleck)\
**Post date:** [November 27, 2020, 11:22am UTC](https://discourse.julialang.org/t/creating-package-with-pkgtemplate-stuck-following-video-tutorial/41572/4 "2020-11-27T11:22:57Z")

</div>

Thanks a lot @grahamstark and @DavidA! I struggled with the same problem for hours… I will link this post to the video’s comments.
