# Importing package into Main conflicts with an existing identifier

**URL:** <https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804>\
**Category:** New to Julia\
**Tags:** package, module\
**Created:** [November 8, 2020, 10:02pm UTC](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804 "2020-11-08T22:02:10Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![josePereiro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josepereiro/32/17322_2.png) [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Post date:** [November 25, 2020, 4:04pm UTC](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804/21 "2020-11-25T16:04:32Z")

</div>

happy to help 🙂

---

<div class="post-metadata">

**Author:** ![Kirby\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirby_zhang/32/36204_2.png) [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Post date:** [May 27, 2022, 7:09am UTC](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804/22 "2022-05-27T07:09:41Z")

</div>

This is understandable, but it can feel frustrating to new users and add unnecessary stress. Should “using MyModule” simply act as if you typed “using .MyModule”, if MyModule already existing in Main?

---

<div class="post-metadata">

**Author:** ![josePereiro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josepereiro/32/17322_2.png) [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Post date:** [May 27, 2022, 7:19am UTC](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804/23 "2022-05-27T07:19:51Z")

</div>

Yes, this is possible. But then you must have a way to distinguish two modules with the same name (e.g one in the environment and another in the parent module). This might be less frequent but introduce exceptions which makes the rule less clear. It is a trade off.

---

<div class="post-metadata">

**Author:** ![Kirby\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirby_zhang/32/36204_2.png) [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Post date:** [May 27, 2022, 8:02am UTC](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804/24 "2022-05-27T08:02:25Z")

</div>

How does typing “using MyModule” multiple times avoid the conflict error? The conflict only occurs if MyModule was first loaded from source; it won’t conflict if loaded from environment.

Using varinfo(imported=true/false), I found that loading module from source, the module is NOT considered as imported, it will show up even with varinfo(imported=false). loading from environment, it IS considered imported, and only shows up with varinfo(imported=true)

---

<div class="post-metadata">

**Author:** ![josePereiro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josepereiro/32/17322_2.png) [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Post date:** [May 27, 2022, 6:11pm UTC](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804/25 "2022-05-27T18:11:03Z")

</div>

I don’t know the internals of using, but in the `master` branch (maybe already on `1.7.3`) the error message is more informative. It suggest you to use the dot if it found a defined module.

[Previous page](https://discourse.julialang.org/t/importing-package-into-main-conflicts-with-an-existing-identifier/49804.md?page=1)
