# What does \`include\` do?

**URL:** <https://discourse.julialang.org/t/what-does-include-do/121699>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 24, 2024, 1:46pm UTC](https://discourse.julialang.org/t/what-does-include-do/121699 "2024-10-24T13:46:17Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [October 25, 2024, 10:07am UTC](https://discourse.julialang.org/t/what-does-include-do/121699/17 "2024-10-25T10:07:45Z")

</div>

> [@anon91151494](#):
>
> The problem comes with templates. The compiler sometimes needs to see the exact code which will be compiled to instantiate (create) an instance of a templated function. This is where both of our memories become a bit vague. It’s difficult to understand what specifically has gone wrong without seeing a concrete example.

Julia doesn’t run into this problem, because you don’t need to `include` source in order to instantiate parametric types or specialize generic functions. You just `import` the module.

In consequence, it’s rare in Julia to `include` a file more than once. You typically [structure your code into one or more packages, which is broken up into one or more files and sub-modules](https://discourse.julialang.org/t/best-practise-organising-code-in-julia/74362/2), and each file is included only a single time — `include` is used more like a `Makefile` to tell Julia what code makes up the package, in what order. You re-use code by importing modules (either submodules or other packages), not by `include`-ing files.

---

_[View the full topic](https://discourse.julialang.org/t/what-does-include-do/121699)._
