# Clarification on the scope of import/using/include

**URL:** <https://discourse.julialang.org/t/clarification-on-the-scope-of-import-using-include/117222>\
**Category:** New to Julia\
**Tags:** question, scope, import\
**Created:** [July 19, 2024, 8:55am UTC](https://discourse.julialang.org/t/clarification-on-the-scope-of-import-using-include/117222 "2024-07-19T08:55:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zotnam](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zotnam/32/205781_2.png) [@Zotnam](https://discourse.julialang.org/u/Zotnam)\
**Post date:** [July 19, 2024, 8:55am UTC](https://discourse.julialang.org/t/clarification-on-the-scope-of-import-using-include/117222/1 "2024-07-19T08:55:36Z")

</div>

Hi guys, i was trying to understand the source code of the package ([conformalprediction.jl](https://github.com/JuliaTrustworthyAI/ConformalPrediction.jl),  
and i have noticed something that i didn’t expect. i am quite new to julia and  
I thought that when i used `import` or `using` in a file the functions imported would be available to be called only in that specific file. However, in this package the functions defined in utils are called from every file. Moreover, despite the fact that `import MLJModelInterface as MMI` is only used in classifier.jl, every other file relies on the interface to define new functions.

so my question is: how does the scoping work when i use import or using?

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [July 19, 2024, 9:44am UTC](https://discourse.julialang.org/t/clarification-on-the-scope-of-import-using-include/117222/2 "2024-07-19T09:44:49Z")

</div>

Difference `import` vs `using`:

- `import MLJModelInterface` only brings the module into scope, but none of its exported symbols. You can access all symbols from that module by prefixing them with `MLJModelInterface.`
- `using MLJModelInterface` brings in all exported symbols of that module in the current one. You can still access non-exported symbols from `MLJModelInterface ` as you would when you just would have `import`ed it

* * *

> [@Zotnam](#):
>
> I thought that when i used `import` or `using` in a file the functions imported would be available to be called only in that specific file.

`import` and `using` act on a Module basis.  
If you have a module like

```julia
module ABC
include("utils.jl")
end

```

and

```julia
# utils.jl
import MLJModelInterface as MMI 

```

then `MLJModelInterface` will be made available also in `ABC`.  
You can think of `include(...)` as ‘copy-pasting’ the code into the place where the `include` appeared.
