# Missing reference with multiple include files

**URL:** <https://discourse.julialang.org/t/missing-reference-with-multiple-include-files/72484>\
**Category:** New to Julia\
**Tags:** vscode\
**Created:** [December 2, 2021, 7:06pm UTC](https://discourse.julialang.org/t/missing-reference-with-multiple-include-files/72484 "2021-12-02T19:06:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Lombardi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marco_lombardi/32/14608_2.png) [@Marco\_Lombardi](https://discourse.julialang.org/u/Marco_Lombardi)\
**Post date:** [December 2, 2021, 7:06pm UTC](https://discourse.julialang.org/t/missing-reference-with-multiple-include-files/72484/1 "2021-12-02T19:06:34Z")

</div>

I am writing some code in VSCode, and I am not sure how what it the best way to split the code in multiple files. As indicated in the Julia documentation, a typical way is to have a single file that includes in the correct order a list of source files:

```julia
module X
include("a.jl")
include("b.jl")
include("c.jl")
end

```

My problem is that many definitions present in `a.jl` are actually used in `b.jl` and `c.jl`: as a result, the linter in VSCode shows a lot of “Missing reference” errors which really annoy me and which make almost useless the linter itself (in the sense that a typo creating a genuine “missing reference” error is easily missed).

What is the way of solving this issue? Including `a.jl` in `b.jl` and in `c.jl` would be a workaround but this would also force Julia to load the file multiple times, which clearly is not a good thing…

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [December 2, 2021, 7:27pm UTC](https://discourse.julialang.org/t/missing-reference-with-multiple-include-files/72484/2 "2021-12-02T19:27:03Z")

</div>

> [@Marco\_Lombardi](#):
>
> but this would also force Julia to load the file multiple times, which clearly is not a good thing…

Yeah, you definitely don’t want this. It’s worse than a performance issue: Every time you `include("a.jl")` you will be creating _new_ functions and types with the same names, which is confusing and error-prone. Each file should be `include`d exactly once, period.

Sorry I don’t have an easy answer for the linter question–I just figured I could save you some headache if you decided to go down the road of including files multiple times.

---

<div class="post-metadata">

**Author:** ![Marco\_Lombardi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marco_lombardi/32/14608_2.png) [@Marco\_Lombardi](https://discourse.julialang.org/u/Marco_Lombardi)\
**Post date:** [December 2, 2021, 7:51pm UTC](https://discourse.julialang.org/t/missing-reference-with-multiple-include-files/72484/3 "2021-12-02T19:51:05Z")

</div>

Yes, I fully agree. On the other hand putting everything in a gigantic single file is also not good: in this case it is OK for Julia, but quite bad for humans.
