# Conflicting import of function with different signatures from multiple modules

**URL:** <https://discourse.julialang.org/t/conflicting-import-of-function-with-different-signatures-from-multiple-modules/21110>\
**Category:** New to Julia\
**Created:** [February 23, 2019, 1:48pm UTC](https://discourse.julialang.org/t/conflicting-import-of-function-with-different-signatures-from-multiple-modules/21110 "2019-02-23T13:48:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![crlaugh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crlaugh/32/1817_2.png) [@crlaugh](https://discourse.julialang.org/u/crlaugh)\
**Post date:** [February 23, 2019, 1:48pm UTC](https://discourse.julialang.org/t/conflicting-import-of-function-with-different-signatures-from-multiple-modules/21110/1 "2019-02-23T13:48:20Z")

</div>

I am having difficulty importing functions that have the same name but different signatures from two different modules. It seems to me that I should be able to import both functions, since the signatures are different, but the REPL yells at me. How can I do this?

As a MWE:

```julia
module TypeDef
    export VariableType
    abstract type VariableType end
end

module Mod1 
    using ..TypeDef
    export Foo, TestFcn

    mutable struct Foo <: VariableType
        x::Float64
        y::Float64

        function Foo(s::String)
            println(string)
            return new(x,y)
        end
    end

    function TestFcn(f::Foo, z::Float64)
        println("Variables: ", "$(f.x+z)")
    end

end

module Mod2
    using ..TypeDef
    export Bar, TestFcn

    mutable struct Bar <: VariableType
        x::Float64
        y::Float64

        function Bar(s::String)
            println(string)
            return new(x,y)
        end
    end

    function TestFcn(f::Bar, z::Float64)
        println("More variables: ", "$(f.y + z)")
    end
end

using .TypeDef

import .Mod1: Foo, TestFcn
import .Mod2: Bar, TestFcn

```

This returns the following:

```julia
julia> using .TypeDef
julia> import .Mod1: Foo, TestFcn
julia> import .Mod2: Bar, TestFcn
WARNING: ignoring conflicting import of Mod2.TestFcn into Main
```

---

<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:** [February 23, 2019, 2:25pm UTC](https://discourse.julialang.org/t/conflicting-import-of-function-with-different-signatures-from-multiple-modules/21110/2 "2019-02-23T14:25:37Z")

</div>

They are different functions, so you cannot “merge” them. This has been discussed [at length](https://discourse.julialang.org/t/function-name-conflict-adl-function-merging/10335).

You can either

1. define `TestFcn` in `TypeDef`, and have both `Mod1` and `Mod2` import it (which I guess is what you want),
2. `import Mod1` and use `Mod1.TestFcn`, or not export it and do the same.

Also, note that most people use lowercase function names in Julia.
