# Preferred way of using dependencies of a module

**URL:** <https://discourse.julialang.org/t/preferred-way-of-using-dependencies-of-a-module/96680>\
**Category:** General Usage\
**Tags:** package, module, dependencies\
**Created:** [March 27, 2023, 8:53pm UTC](https://discourse.julialang.org/t/preferred-way-of-using-dependencies-of-a-module/96680 "2023-03-27T20:53:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![touste](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touste/32/10758_2.png) [@touste](https://discourse.julialang.org/u/touste)\
**Post date:** [March 27, 2023, 8:53pm UTC](https://discourse.julialang.org/t/preferred-way-of-using-dependencies-of-a-module/96680/1 "2023-03-27T20:53:31Z")

</div>

I wonder what is the difference between:

1. 

```julia
] add GLMakie # Note that this installs several dependencies, including GeometryBasics
using GLMakie
using GLMakie.GeometryBasics

```

1. 

```julia
] add GLMakie GeometryBasics
using GLMakie
using GeometryBasics

```

Is there any preference / difference between these two approaches? I have been using the first one as it means fewer direct dependencies in my `Project.toml`, but I usually see the second approach.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 27, 2023, 9:26pm UTC](https://discourse.julialang.org/t/preferred-way-of-using-dependencies-of-a-module/96680/2 "2023-03-27T21:26:11Z")

</div>

If you actually use the package directly, you should probably make it an explicit and direct dependency. You could then later control the revision of that dependency directly via Project.toml.

Accessing indirect dependencies via direct dependencies is a bit of a hack, but can be useful when using conditional dependencies. I would generally avoid doing this.

---

<div class="post-metadata">

**Author:** ![touste](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touste/32/10758_2.png) [@touste](https://discourse.julialang.org/u/touste)\
**Post date:** [March 27, 2023, 9:38pm UTC](https://discourse.julialang.org/t/preferred-way-of-using-dependencies-of-a-module/96680/3 "2023-03-27T21:38:35Z")

</div>

Thanks, that makes sense! Although it means more dependencies to manage, it also offers a finer control over the version being used.
