# Question regarding "WARNING: ignoring conflicting import"

**URL:** <https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 8, 2022, 11:40am UTC](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579 "2022-03-08T11:40:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sijun](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Post date:** [March 8, 2022, 11:40am UTC](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579/1 "2022-03-08T11:40:44Z")

</div>

No matter how many times I run the following, I get no warning or error:

```julia
using CSV: getrow

```

However, I get warning when I do this more than once:

```julia
module Test

function func()
    println("func")
end

end

using .Test: func

```

> WARNING: ignoring conflicting import of Test.func into Main

Why do they behave differently?

---

<div class="post-metadata">

**Author:** ![Salmon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/salmon/32/22968_2.png) [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Post date:** [March 9, 2022, 4:41pm UTC](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579/2 "2022-03-09T16:41:31Z")

</div>

This is something that is easy to stumble upon. I am not an expert but I would say to a good degree the first case can be understood in the following way:  
You tell Julia to bring a function `getrow` from the module `CSV` into scope. Julia will first check if this module in your environment, and then import the function from the currently installed version of the module.  
If you do that again, the module (and thus also the function) will be inherently the same, so everything should be fine.

In the second case you are first defining a new module with the name `Test` and again bringing the function definition into global scope. So far so good.

However now you do the same thing again: You re-define the module and therefore there is an inherent conflict which method is the correct one, the one from the previously defined module or the current one.

(I have assumed that you also defined the module again. I have no way of checking this right now, but I believe just calling `using .Test: func` several times should not throw a warning, right?)

Overall, I am not sure what the reason is why modules do not simply get overwritten in the same way that functions are. For this, the Revise-based workflow is best used: I often develop my module, say in some folder `Test/src/Test.jl` and then simply type `]dev Test` to add this module to the environment. Revise picks up all changes I make to the file so whenever I safe the file, the functions get updated.  
I think you can also put your module in a single file and explicitly call `using Revise; includet("fileWithModule.jl")` which should also do the trick as far as I know.  
Hope that helps!

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [March 9, 2022, 8:01pm UTC](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579/3 "2022-03-09T20:01:45Z")

</div>

```julia
julia> module F
       f() = 1
       end
Main.F

julia> using .F: f

julia> using .F: f

julia> f()
1

julia> module F
       f() = 2
       end
WARNING: replacing module F.
Main.F

julia> f()
1

julia> using .F: f
WARNING: ignoring conflicting import of F.f into Main

julia> f()
1

julia> F.f()
2

```

---

<div class="post-metadata">

**Author:** ![Sijun](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Post date:** [March 13, 2022, 12:41am UTC](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579/4 "2022-03-13T00:41:00Z")

</div>

Now I understand what happened. Thank you so much for the useful tips too!
