# Combine using M: a, b; import M

**URL:** <https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 25, 2018, 8:28am UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030 "2018-08-25T08:28:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 25, 2018, 8:28am UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030/1 "2018-08-25T08:28:09Z")

</div>

Now that

```julia
using M: a, b

```

does not import `M` _per se_, I found that I have to add an `import` explicitly when I am being very tidy with namespaces in packages (just `using` what I use frequently, qualify the rest).

Is it possible to combine these two in a single line?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 26, 2018, 8:17am UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030/2 "2018-08-26T08:17:22Z")

</div>

```julia
using M: a, b, M

```

appears to work.

I wonder it this is accidental, or something I can rely on. I am inclined to the latter, since here I am using `M` as a symbol, not as a module designator (which would require `using M.Submodule`).

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [August 26, 2018, 12:23pm UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030/3 "2018-08-26T12:23:46Z")

</div>

Nice trick, which should always work as there is always a self-reference.

---

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [August 27, 2018, 7:15am UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030/4 "2018-08-27T07:15:39Z")

</div>

Thank you! I was facing a warning in 0.7 with that so concluded it was not valid, and hadn’t thought it could be ok on 1.0.

---

<div class="post-metadata">

**Author:** ![jeff.bezanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff.bezanson/32/48_2.png) [@jeff.bezanson](https://discourse.julialang.org/u/jeff.bezanson)\
**Post date:** [August 27, 2018, 7:40pm UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030/5 "2018-08-27T19:40:23Z")

</div>

Yes, this will keep working (unless we remove the module “self reference”, which some people want, but I don’t think is likely). There was a warning in 0.7 because `using M: M` used to be equivalent to `using M`, but now will just bring in a single binding for `M` itself rather than everything exported from it.

---

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [August 27, 2018, 8:26pm UTC](https://discourse.julialang.org/t/combine-using-m-a-b-import-m/14030/6 "2018-08-27T20:26:57Z")

</div>

Nice, I didn’t know about this. This was my only use-case for `import`, but now I can replace all my `import M` with `using M: M` and not need `import` at all.

🎆 🎆
