# Revise with include chain

**URL:** https://discourse.julialang.org/t/revise-with-include-chain/103684
**Category:** New to Julia
**Tags:** revise
**Created:** [September 8, 2023, 10:51pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684 "2023-09-08T22:51:44Z")
**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 8, 2023, 10:51pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/1 "2023-09-08T22:51:44Z")

</div>

Hi guys,

how do I make Revise work properly here?

File1:

```julia
using Revise
includet("testrevise1.jl")
using .testrevise1  

func()

```

File “testrevise1.jl”:

```julia
module testrevise1

export func

include("testrevise2.jl")

end

```

File “testrevise2.jl”:

```julia
function func()
    print("hello world! 4")
end

```

Does the second file have to load Revise as well?

---

<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 8, 2023, 11:03pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/2 "2023-09-08T23:03:49Z")

</div>

[This short thread](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872) addresses this, this is how `includet` is supposed to work: “include and track _this_ file”. To automatically track a network of included files, you need to [work on a package](https://timholy.github.io/Revise.jl/stable/#Usage-example-1). I think you could technically replace nested `include`s with `includet` but you’d also have to temporarily import `Revise` in all your modules, and that’s not recommended over package work.

An aside, the other issue that thread addresses appears to have been patched by now.

---

<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 9, 2023, 10:26pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/3 "2023-09-09T22:26:36Z")

</div>

I am a bit lost with packages… The docs are either too trivial or too difficult for me xD

Here is a test:  
I create a package named “REVISETEST”, whose /src folder holds two files:  
`REVISETEST.jl`

```julia
module REVISETEST

include("revise_include.jl")

end # module REVISETEST

```

and `revise_include.jl`

```julia
function this_is_sparta()
    print("This is SPARTA!!!!")
end

```

After `Pkg.activate("REVISETEST")`, I open some main file:

```julia
using REVISETEST

REVISETEST.this_is_sparta()

```

Note that I don’t even use Revise here. Yet, if I comment out the Sparta function in `revise_include` and save the file, and then re-run the main file (without restarting Julia), the function is gone. Are packages automatically “revised”, or what is going on here?

---

<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 9, 2023, 10:48pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/4 "2023-09-09T22:48:12Z")

</div>

After editing a file in its package, rerunning `using REVISETEST` actually [reevaluates and reimports it](https://discourse.julialang.org/t/best-practice-develop-and-adjust-own-package-precompilation/103656/4). Revise is designed to automatically make some small changes to live code when you edit the tracked source code, no need to do the big overhauls (rerunning `include`, `using`, `import`) and waste time reevaluating lines you didn’t change. You will have to do the big overhauls once in a while because small interactive changes out of order does not always have the same effect, but you can get a lot done with small changes.

---

<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 9, 2023, 11:00pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/5 "2023-09-09T23:00:13Z")

</div>

but it seems to work even if I comment `using REVISETEST` out. Is VScode doing some magic here?

---

<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 9, 2023, 11:06pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/6 "2023-09-09T23:06:09Z")

</div>

What seems to work? The whole process you described above? Did you make sure to go through the process twice, once to make `this_is_sparta` exist in the session and once after commenting it out in the source? I don’t use VScode so I can’t really answer this, I’m just curious because it’s unexpected.

---

<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 9, 2023, 11:20pm UTC](https://discourse.julialang.org/t/revise-with-include-chain/103684/7 "2023-09-09T23:20:16Z")

</div>

I just realized the VSCode Julia extension has a setting in which Revise is loaded by default. That will have disturbed my little experiments.

I deactivated it now and load Revise manually. I think everything works as expected then.  
I simply have

```julia
using Revise
using REVISETEST

REVISETEST.this_is_sparta()

```

If I now modify the sparta function and save, I can immediately call the modified function, I don’t even have to re-run the `using` command.

Thanks for your help!
