# Why doesn't method dispatch work on the same candidate included from different sources?

**URL:** <https://discourse.julialang.org/t/why-doesnt-method-dispatch-work-on-the-same-candidate-included-from-different-sources/85576>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 10, 2022, 8:35am UTC](https://discourse.julialang.org/t/why-doesnt-method-dispatch-work-on-the-same-candidate-included-from-different-sources/85576 "2022-08-10T08:35:11Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [August 10, 2022, 11:00am UTC](https://discourse.julialang.org/t/why-doesnt-method-dispatch-work-on-the-same-candidate-included-from-different-sources/85576/10 "2022-08-10T11:00:25Z")

</div>

> [@DiMeneses](#):
>
> I’m not sure what’s a `MWE` I tried googling it but to no avail, that should answer your question 😃

It’s a [(M)inimal (W)orking (E)xample](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757).

> [@DiMeneses](#):
>
> File `methods.jl`:
> 
> ```julia
> include("structs.jl")
> 
> ```

> [@DiMeneses](#):
>
> File `load.jl`:
> 
> ```julia
> include("structs.jl")
> 
> ```

You’re still including that file twice, which will still create two modules. The first module will be the one `Load` sees and binds to, then in `methods.jl` you create a _new_ `Structs` module which is what `Methods` sees and binds to (and which overwrites the binding created in `load.jl`).

I don’t know why you’re creating submodules for the structs in particular, I’d just have them defined like so:

> **poet.jl**
>
> ```julia
> module Poet
> include("structs.jl")
> include("methods.jl")
> end
> 
> ```

> **structs.jl**
>
> ```julia
> struct myStruct
> ...
> end
> 
> ```

> **modules.jl**
>
> ```julia
> function method(strt::myStruct)
> "I got called"
> end
> 
> ```

---

_[View the full topic](https://discourse.julialang.org/t/why-doesnt-method-dispatch-work-on-the-same-candidate-included-from-different-sources/85576)._
