# Is there a way to implicitly convert two variables with the same \*intrinsic type\*

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-implicitly-convert-two-variables-with-the-same-intrinsic-type/55006>\
**Category:** General Usage\
**Created:** [February 10, 2021, 3:58pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-implicitly-convert-two-variables-with-the-same-intrinsic-type/55006 "2021-02-10T15:58:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 10, 2021, 3:58pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-implicitly-convert-two-variables-with-the-same-intrinsic-type/55006/1 "2021-02-10T15:58:25Z")

</div>

Is there a way to implicitly convert two variables with the same _intrinsic type_ but coming from different modules? see below for example

```julia
LoadError: MethodError: no method matching synthetise_schedule(::Array{Main.Scheduler.Loader.Entities.Agent,1}, ::Array{<http://Main.Scheduler.Loader.Entities.Space|Main.Scheduler.Loader.Entities.Space>,1}, ::Dict{String,Array{String,1}})
Closest candidates are:
synthetise_schedule(::Array{Main.Scheduler.Entities.Agent,1}, ::Array{<http://Main.Scheduler.Entities.Space|Main.Scheduler.Entities.Space>,1}, ::Dict{String,Array{String,1}}) 

```

For instance,  
`<http://Main.Scheduler.Loader.Entities.Space|Main.Scheduler.Loader.Entities.Space>` and `<http://Main.Scheduler.Entities.Space|Main.Scheduler.Entities.Space>` refer to the same element but for some reason they are not considered the same type.  
I don’t export types in any of my modules and sub-modules, but I have the following `using` statements at the top of my `Scheduler` module

```julia
using .Loader: load_data, read_config
using .Entities: Agent, Space, Event

```

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1612972505471500?thread_ts=1612972505.471500&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [February 10, 2021, 4:14pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-implicitly-convert-two-variables-with-the-same-intrinsic-type/55006/2 "2021-02-10T16:14:08Z")

</div>

You should be importing the shared type from one module, and that module, call it M, should have `export Typename` (for your Typename) near the top of the file (after the line beginning `module`). Other modules that want to use that type should have a line `using M: Typename` near the top of the file (after any export lines).  
The example below is as typed into the REPL (hence the dots).

```julia
module A
  export MyType

  struct MyType
    x::Int
  end

  # etc
end

module B
   using ..A: MyType
   # etc
end

module C
  using ..A: MyType
  # etc
end

# now they are all the same
using .A: MyType # ok
using .B: MyType # ok
using .C: MyType # ok

```
