# Does Revise work with plain modules?

**URL:** <https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584>\
**Category:** New to Julia\
**Created:** [September 6, 2023, 8:56pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584 "2023-09-06T20:56:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leibniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leibniz/32/217959_2.png) [@Leibniz](https://discourse.julialang.org/u/Leibniz)\
**Post date:** [September 6, 2023, 8:56pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/1 "2023-09-06T20:56:11Z")

</div>

When making a change to a module, I thought I simply needed to save the file and then re-run the importing script (which loads Revise at the very top). But the changes are only ever respected if I not only save the module file but also re-run its source in the current Julia session.

Is this normal?

edit: using VS code.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [September 6, 2023, 11:26pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/2 "2023-09-06T23:26:50Z")

</div>

This is very vague without code or descriptions, what do you mean by plain module and how is the (separate?) script importing it? What do you do to “re-run” something, `include`? Is that module a package?

---

<div class="post-metadata">

**Author:** ![Leibniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leibniz/32/217959_2.png) [@Leibniz](https://discourse.julialang.org/u/Leibniz)\
**Post date:** [September 6, 2023, 11:38pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/3 "2023-09-06T23:38:41Z")

</div>

Sorry, to be more precise:

```julia
module testmod
    
function func()
    print("hello")
end

end

```

In another file then:

```julia

using Revise
using .testmod

testmod.func()

```

No packages. By re-run I mean pressing Alt+Enter with the open file.

So if I make a change to the module, saving the file alone is not enough. I have to press Alt+Enter as well. Otherwise running the calling file will still lead to the old version of the module being used.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [September 6, 2023, 11:45pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/4 "2023-09-06T23:45:45Z")

</div>

> [@Leibniz](#):
>
> pressing Alt+Enter with the open file.

That’ll be an `include`. Your importing script lacks an `include` for the `testmod` file, are you running both files in order then? Otherwise if you only run the importing script, `using .testmod` should fail.

Revise uses [`includet` for non-package files](https://timholy.github.io/Revise.jl/stable/cookbook/#includet-usage-1), and the purpose is to _not_ re-run files manually (in fact reevaluating a module can easily make a mess out of a session).

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [September 6, 2023, 11:47pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/5 "2023-09-06T23:47:06Z")

</div>

> [@Leibniz](#):
>
> By re-run I mean pressing Alt+Enter with the open file.

In VS code? You might try `includet(testmod.jl)` (yes, the `t` at the end is intentional) - I’m not sure Revise knows how to update when it’s run from vs code, which is essentially the same as pasting it into the repl

---

<div class="post-metadata">

**Author:** ![George9000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george9000/32/23619_2.png) [@George9000](https://discourse.julialang.org/u/George9000)\
**Post date:** [September 7, 2023, 12:02am UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/6 "2023-09-07T00:02:49Z")

</div>

Related: take a look [here](https://discourse.julialang.org/t/how-to-set-environment-for-local-julia-package-in-module/100106/6) and the entire thread.

---

<div class="post-metadata">

**Author:** ![Leibniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leibniz/32/217959_2.png) [@Leibniz](https://discourse.julialang.org/u/Leibniz)\
**Post date:** [September 7, 2023, 6:22pm UTC](https://discourse.julialang.org/t/does-revise-work-with-plain-modules/103584/7 "2023-09-07T18:22:22Z")

</div>

Thank you guys, simply changing the line `using .testmod` to `includet("testmod.jl")` worked.
