# More basic Revise usage with module

**URL:** <https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517>\
**Category:** General Usage\
**Tags:** question, first-steps\
**Created:** [August 14, 2019, 2:29am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517 "2019-08-14T02:29:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pearlzli](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Post date:** [August 14, 2019, 2:29am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/1 "2019-08-14T02:29:28Z")

</div>

Hello, I’m having trouble getting Revise to track changes to my module. I have `using Revise` in my startup.jl, and I’ve checked that it is indeed being loaded on startup. I then try:

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

(v1.1) pkg> dev MyPackage
[ Info: resolving package specifier `MyPackage` as a directory at `~/Desktop/MyPackage`.
 Resolving package versions...
   Updating `~/.julia/environments/v1.1/Project.toml`
     [79904e14] + MyPackage v0.1.0 [`../../../Desktop/MyPackage`]
       Updating `~/.julia/environments/v1.1/Manifest.toml`
         [79904e14] + MyPackage v0.1.0 [`../../../Desktop/MyPackage`]

julia> using MyPackage
[Info: Precompiling MyPackage [79904e14-be3a-11e9-0fa2-d3186fc9e44a]

julia> MyPackage.greet()
Hello World!

```

At this point, I edit MyPackage.jl to add a function `foo`. Then:

```julia
julia> MyPackage.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
  [2] top-level scope at none:0

julia> revise(MyPackage)
true

julia> MyPackage.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
  [2] top-level scope at none:0

```

---

<div class="post-metadata">

**Author:** ![kmundnic](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@kmundnic](https://discourse.julialang.org/u/kmundnic)\
**Post date:** [August 14, 2019, 3:20am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/2 "2019-08-14T03:20:47Z")

</div>

Most likely `Revise` is not looking in `~/Desktop/MyPackage`, where you generated your package. You can push it to your `LOAD_PATH` using `push!(LOAD_PATH, expanduser("~/Desktop/"))`.

After reading from several sources, it seems like the recommended option is to develop in `~/.julia/dev`. This is what I have included in my `~/.julia/config/startup.jl` file, so that I can generate a package and use `Revise` every time I start Julia automatically:

```julia
push!(LOAD_PATH, expanduser("~/.julia/dev/"))

atreplinit() do repl
    try
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
        @warn "Package Revise not found"
    end
end

```

---

<div class="post-metadata">

**Author:** ![pearlzli](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Post date:** [August 14, 2019, 3:35am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/3 "2019-08-14T03:35:51Z")

</div>

Hmm I tried adding `push!(LOAD_PATH, expanduser("~/Desktop/"))` to startup.jl (before `using Revise`, in case that matters) and it still doesn’t seem to work:

```julia
julia> LOAD_PATH
4-element Array{String,1}:
 "@"
  "@v#.#"
   "@stdlib"
    "/Users/pearl/Desktop/"

(v1.1) pkg> dev MyPackage
[ Info: resolving package specifier `MyPackage` as a directory at `~/Desktop/MyPackage`.
 Resolving package versions...
   Updating `~/.julia/environments/v1.1/Project.toml`
    [no changes]
      Updating `~/.julia/environments/v1.1/Manifest.toml`
       [no changes]

julia> using MyPackage
[Info: Recompiling stale cache file /Users/pearl/.julia/compiled/v1.1/MyPackage/zIxTC.ji for MyPackage [79904e14-be3a-11e9-0fa2-d3186fc9e44a]

julia> MyPackage.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
  [2] top-level scope at none:0

```

Then define `foo`:

```julia
julia> MyPackage.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
  [2] top-level scope at none:0

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 14, 2019, 6:35am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/4 "2019-08-14T06:35:38Z")

</div>

There should be no need to modify `LOAD_PATH` or explicitly call `revise`. Load Revise first, then load your package then it should work.

---

<div class="post-metadata">

**Author:** ![pearlzli](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Post date:** [August 14, 2019, 6:48am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/5 "2019-08-14T06:48:10Z")

</div>

Curiously, it does work for me when I remove `using Revise` from startup.jl and call it in the REPL instead. Can anyone else reproduce this problem?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 14, 2019, 8:04am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/6 "2019-08-14T08:04:56Z")

</div>

Did you do like the docs describe?

[https://timholy.github.io/Revise.jl/stable/config/#Using-Revise-by-default-1](https://timholy.github.io/Revise.jl/stable/config/#Using-Revise-by-default-1)

---

<div class="post-metadata">

**Author:** ![pearlzli](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Post date:** [August 14, 2019, 8:22am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/7 "2019-08-14T08:22:19Z")

</div>

Ah no, I completely missed that, thank you! Would it be possible to make the link to that page on [Home · Revise.jl](https://timholy.github.io/Revise.jl/stable/) a little more insistent, for those of us who brashly think “I know how to add things to startup.jl”?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 14, 2019, 9:51am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/8 "2019-08-14T09:51:47Z")

</div>

I think that mentioning the possibility at the very beginning of the docs would help, since this is the configuration almost everyone uses. Perhaps open an issue, or better, make a PR at the Revise.jl repository.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [August 14, 2019, 10:03am UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/9 "2019-08-14T10:03:57Z")

</div>

> [@Tamas\_Papp](#):
>
> since this is the configuration almost everyone uses

I’m not so sure about this. Personally, I like to `using Revise` manually as I don’t always need it (and am kind of obsessed about startup times 😃)

But I agree that having this more prominently placed wouldn’t hurt. I remember that I also put `using Revise` in my `startup.jl` at some point and wondered why it didn’t work as expected.

---

<div class="post-metadata">

**Author:** ![pearlzli](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Post date:** [August 15, 2019, 5:15pm UTC](https://discourse.julialang.org/t/more-basic-revise-usage-with-module/27517/10 "2019-08-15T17:15:53Z")

</div>

Done: [https://github.com/timholy/Revise.jl/pull/329](https://github.com/timholy/Revise.jl/pull/329)
