# Dependencies of src files inside a package

**URL:** <https://discourse.julialang.org/t/dependencies-of-src-files-inside-a-package/43144>\
**Category:** General Usage\
**Tags:** dependencies\
**Created:** [July 15, 2020, 7:44pm UTC](https://discourse.julialang.org/t/dependencies-of-src-files-inside-a-package/43144 "2020-07-15T19:44:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [July 15, 2020, 8:48pm UTC](https://discourse.julialang.org/t/dependencies-of-src-files-inside-a-package/43144/2 "2020-07-15T20:48:26Z")

</div>

The problem is that you’re `include()`ing the same file multiple times. Each time you `include("a.jl")`, you create a _new_ module named `A`, with new, incompatible, types and functions. You need to ensure that each file is included exactly once.

For example, you could do:

```julia
## M.jl
module M

include("A.jl")
using .A
include("B.jl")
using .B

end

## A.jl
module A
  ...
end

## B.jl
module B

using ..A

end

```

Note that we can still _use_ module `A` within module `B` without _including_ it again there.

---

_[View the full topic](https://discourse.julialang.org/t/dependencies-of-src-files-inside-a-package/43144)._
