# WARNING: using XXX.xxx in module Main conflicts with an existing identifier

**URL:** <https://discourse.julialang.org/t/warning-using-xxx-xxx-in-module-main-conflicts-with-an-existing-identifier/77825>\
**Category:** New to Julia\
**Created:** [March 13, 2022, 4:28pm UTC](https://discourse.julialang.org/t/warning-using-xxx-xxx-in-module-main-conflicts-with-an-existing-identifier/77825 "2022-03-13T16:28:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yashi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yashi/32/19448_2.png) [@yashi](https://discourse.julialang.org/u/yashi)\
**Post date:** [March 13, 2022, 4:28pm UTC](https://discourse.julialang.org/t/warning-using-xxx-xxx-in-module-main-conflicts-with-an-existing-identifier/77825/1 "2022-03-13T16:28:34Z")

</div>

(I’m using Makie as an example but I think my question is how Julia handle Modules and `export`.)

When I run the following code in a REPL session, I get

> WARNING: using GeometryBasics.Mesh in module Main conflicts with an existing identifier.

```julia-auto
using GLMakie
f = Figure()
a = Axis(f[1, 1])
using GeometryBasics

```

My questions are

1. Why do I get the warning?
2. What exactly does it mean?
3. How do I debug / test / investigate when I get the warning?

### What I have done so far

If I comment out `Axis()`, I don’t get that warning.

```julia-auto
using GLMakie
f = Figure()
#a = Axis(f[1, 1])
using GeometryBasics

```

It seems to me both Makie and GeometryBasics exports `Mesh`:

```julia-auto
:Mesh in names(Makie) #-> true
:Mesh in names(GLMakie) #-> true
:Mesh in names(GeometryBasics) #-> true

```

But the module Main doesn’t have it:

```julia-auto
julia> names(Main)
7-element Vector{Symbol}:
 :Base
 :Core
 :InteractiveUtils
 :Main
 :a
 :ans
 :f

```

When I use `?`, REPL seems to know the identifier `Mesh` but throw `UndefRefError`

```julia-auto
help?> Mesh
search: Mesh mesh mesh! MeshMeta MeshScatter meshscatter meshscatter! UVMesh uv_mesh GLUVMesh GLUVMesh3D GLUVMesh2D PlainMesh GLPlainMesh GLPlainMesh3D GLPlainMesh2D TriangleMesh AbstractMesh

ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] getproperty
   @ ./Base.jl:37 [inlined]
 [2] summarize(io::IOBuffer, TT::Type, binding::Base.Docs.Binding)
   @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/docview.jl:286
 [3] summarize(binding::Base.Docs.Binding, sig::Type)
   @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/docview.jl:249
 [4] doc(binding::Base.Docs.Binding, sig::Type)
   @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/docview.jl:182
 [5] doc(binding::Base.Docs.Binding)
   @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/docview.jl:160
 [6] top-level scope
   @ ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/docview.jl:470

julia> 

```

### Searched here in this forum

Some one suggest that [importing the same file twice](https://discourse.julialang.org/t/warnings-overwritten-method-definition-and-module-main-conflict-with-existing-identifier/1377/2) cause this warning, but I can’t reproduce with:

```julia-auto
julia> import GeometryBasics: Mesh
julia> import GeometryBasics: Mesh
julia> 

```

I can’t do `import MakieCore: Mesh`, can I?

### Searched source code but…

`src/Makie.jl` has

```julia-auto
using MakieCore: Heatmap, [...], Mesh, [...]
export Heatmap, [...], Mesh, [...]

```

`MakieCore/src/basic_plots.jl` has a macro with `Mesh` but I’m not sure exactly what it does

```julia-auto
@recipe(Mesh, mesh) do scene
    Attributes(;
        default_theme(scene)...,
        color = :black,
        backlight = 0f0,
        colormap = theme(scene, :colormap),
        colorrange = automatic,
        interpolate = true,
        shading = true,
        fxaa = true,
        inspectable = theme(scene, :inspectable),
        cycle = [:color => :patchcolor],
        space = :data
    )
end

```

---

<div class="post-metadata">

**Author:** ![josuagrw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josuagrw/32/1015_2.png) [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Post date:** [March 13, 2022, 5:51pm UTC](https://discourse.julialang.org/t/warning-using-xxx-xxx-in-module-main-conflicts-with-an-existing-identifier/77825/2 "2022-03-13T17:51:24Z")

</div>

Hi, so basically you got it correct: you’re importing the identifier `Mesh` from two different modules and so Julia is warning you that you probably need to make sure that you’re using the right identifier in your code. You can do that, for example, with

```julia
using GLMakie
using GeometryBasics
const Mesh = GeometryBasics.Mesh

```

That way it’s absolutely clear which identifier the compiler should use. You can still access the other one with `GLMakie.Mesh`.
