# Error with modules sharing types

**URL:** <https://discourse.julialang.org/t/error-with-modules-sharing-types/37119>\
**Category:** New to Julia\
**Created:** [April 6, 2020, 5:03pm UTC](https://discourse.julialang.org/t/error-with-modules-sharing-types/37119 "2020-04-06T17:03:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [April 6, 2020, 6:47pm UTC](https://discourse.julialang.org/t/error-with-modules-sharing-types/37119/2 "2020-04-06T18:47:50Z")

</div>

Pasting exactly the code you provided into the REPL works as expected:

```julia
julia> # M1.jl
       module M1
           export M1Type
           struct M1Type
               data::Real
           end
       end
Main.M1

julia> # M2.jl
       module M2
           using ..M1
           export f
           function f(x::M1Type)
               
           end
       end
Main.M2

julia> # At the REPL (or main module)
       using .M1

julia> using .M2

julia> f(M1Type(1))

julia> 

```

so the problem has something to do with how you are actually including your files. The results you’re seeing are consistent with having called `include()` on the same file in multiple different modules, which you not ever do (see [Organizing modules. Is it OK to organize a project using several modules in Julia? - #5 by rdeits](https://discourse.julialang.org/t/organizing-modules-is-it-ok-to-organize-a-project-using-several-modules-in-julia/34535/5) , [Organizing structs and modules - #3 by rdeits](https://discourse.julialang.org/t/organizing-structs-and-modules/34993/3) , etc). Can you be more explicit about how you’ve actually set up your code to run into the problem you’re seeing?

---

_[View the full topic](https://discourse.julialang.org/t/error-with-modules-sharing-types/37119)._
