# Question about importing dependencies of package

**URL:** <https://discourse.julialang.org/t/question-about-importing-dependencies-of-package/25790>\
**Category:** General Usage\
**Created:** [June 28, 2019, 7:47am UTC](https://discourse.julialang.org/t/question-about-importing-dependencies-of-package/25790 "2019-06-28T07:47:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [June 28, 2019, 7:47am UTC](https://discourse.julialang.org/t/question-about-importing-dependencies-of-package/25790/1 "2019-06-28T07:47:22Z")

</div>

I am developing a Julia package, say “PackA.jl”. It depends on many other packages, for example, “JSON.jl”.

I put `JOSN` both to `Project.toml` and `REQUIRE`.

In the main source file, “PackA.jl”, there’s a line to use JSON:

```julia
using JSON

```

Then I start julia REPL like this, in the root dir of PackA.jl:

```julia
julia --project=.

```

And:

```julia
julia> using JSON
ERROR: ArgumentError: Package JSON not found in current path:
- Run `import Pkg; Pkg.add("JSON")` to install the JSON package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:876

julia> using PackA.JSON
julia> using JSON
ERROR: ArgumentError: Package JSON not found in current path:
- Run `import Pkg; Pkg.add("JSON")` to install the JSON package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:876

julia> JSON
JSON

```

JSON can only be imported through PackA but can’t be imported directly. Is this by design?

Thanks.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [June 28, 2019, 7:57am UTC](https://discourse.julialang.org/t/question-about-importing-dependencies-of-package/25790/2 "2019-06-28T07:57:16Z")

</div>

> [@KDr2](#):
>
> JSON can only be imported through PackA but can’t be imported directly. Is this by design?

Yes it is.

What packages `PackA` depends on is an implementation detail that you as a user should not see. If you want to `using JSON` should should add JSON as a dependency, not rely on some other package to make it available for you.

---

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [June 28, 2019, 8:09am UTC](https://discourse.julialang.org/t/question-about-importing-dependencies-of-package/25790/3 "2019-06-28T08:09:19Z")

</div>

Thanks.
