# \`Revise.jl\` dosn't work on \`include\`ed files

**URL:** <https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872>\
**Category:** General Usage\
**Created:** [July 27, 2019, 3:18am UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872 "2019-07-27T03:18:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 27, 2019, 3:18am UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872/1 "2019-07-27T03:18:36Z")

</div>

I am having trouble with `Revise.jl`. I have files setup like this:

`Tvaccine.jl`

```julia
module Tvaccine
    using Parameters
    using Distributions
    include("entities.jl")

    export main, world

    function main()
        println("Hello world.")
    end
end

```

`entities.jl`

```julia
function world()
    println("Hello world from included file.")    
end

```

Then I have the `run.jl` file that sets up `Revise.jl`

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

```

Now if I change something in `main()` or add a new function in the `Tvaccine.jl` file (the one that was included using `includet`, everything works as expected. Upon saving my edits, the REPL is updated with the changes.

However, if I edit anything in the `entities.jl` file, it seems that Revise dosn’t pick up on the changes. If I made an edit to the already exported function, it dosn’t reflect in the REPL. If I add a new function, I get a `MethodError: no method matching...`.

Is the expectation to fully code a program in one file?

* * *

My “second” attempt: I `generate` a new folder, and `activate .` which allows me to using `using mypkg`. (`Revise.jl` is already loaded from the start). Everything works as expected except when I make a new file and include that in the main module using `include`. Revise dosn’t seem to bring in the functions defined in the new file.

Note that this is different if the files are already included at the `using mypkg` stage. I hope I make sense, seems like I am kind of rambling on here.

---

<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:** [July 27, 2019, 5:58am UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872/2 "2019-07-27T05:58:51Z")

</div>

> [@affans](#):
>
> Is the expectation to fully code a program in one file?

I would say yes. You may want to open an issue for Revise.

---

<div class="post-metadata">

**Author:** ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Post date:** [July 27, 2019, 6:21am UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872/3 "2019-07-27T06:21:06Z")

</div>

> [@affans](#):
>
> Tvaccine

I think this should work fine assuming the following:

1. Tvaccine has is a package.
2. It is in your LOAD\_PATH
3. Tvaccine.jl has a few include(„somefile“) lines from the beginning.

I am pretty sure revised worked fine for me in such a set up. Have you tried that?

Maybe, it does not work, when you add a new include(„newfile“) to the main code file, but this should be the exception (at least in my workflow)

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [July 27, 2019, 9:26am UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872/4 "2019-07-27T09:26:22Z")

</div>

You should think of `using` and `import` as the “real” ways to track code. `includet` is deliberately intended to be “track just this file”—it’s designed as the manual alternative to the automated smarts of `using` and `import`. You can turn `Tvaccine` into a package in seconds ([GitHub - invenia/PkgTemplates.jl: Create new Julia packages, the easy way](https://github.com/invenia/PkgTemplates.jl)) or use `push!(LOAD_PATH, dir-of-Tvaccine.jl)`. Then `using Tvaccine` should do what you want.

The second issue is a [known bug](https://github.com/timholy/Revise.jl/issues/107). Since that state of affairs is rather transitory (once you add the file and restart everything works going forward), it’s not really been a priority of mine. For anyone really bugged by this, there was a [start on a fix](https://github.com/timholy/Revise.jl/pull/232) that could use help getting over the line. Unfortunately, the internal architecture of Revise has changed substantially since then so I suspect it’s not a small project.

---

<div class="post-metadata">

**Author:** ![senhalil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/senhalil/32/42473_2.png) [@senhalil](https://discourse.julialang.org/u/senhalil)\
**Post date:** [September 5, 2022, 3:01pm UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872/5 "2022-09-05T15:01:19Z")

</div>

Having a similar issue. I can’t seem to make vscode and Revise aware of my local module at the same time.

If I do as follows, vscode works as expected – i.e., I can click and go to definition of an exported function from my script and the files defining these functions are parsed correctly, etc. – but Revise dosn’t pick up on the changes:

```julia
include("module_file.jl")
using .module_name

```

If I include it via `Revise.includet` or as a package via `using`, Revise can pickup the changes; however, now vscode doesn’t parse the module files and doesn’t let me click&go to definition.

Is there a way to make these two things work as expected at the same time?

---

<div class="post-metadata">

**Author:** ![senhalil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/senhalil/32/42473_2.png) [@senhalil](https://discourse.julialang.org/u/senhalil)\
**Post date:** [September 7, 2022, 1:04pm UTC](https://discourse.julialang.org/t/revise-jl-dosnt-work-on-include-ed-files/26872/6 "2022-09-07T13:04:15Z")

</div>

This might have been related to a bug with the julia-vscode-language-server 🤷 I switch the Julia “insider” extension on VSCode and now everything works as expected via `using MyModule` – Revise picks up changes, VSCode lets me go to definition and shows the documentation.
