Error with same type called from different modules

How could I avoid the following error ?

ERROR: LoadError: MethodError: no method matching getlinearspeedcoeffs(::Main.MultiPro.ProfileMod.VortexElement.LinearPanel, ::Main.MultiPro.ProfileMod.VortexElement.LinearPanel, ::Bool)
Closest candidates are:
getlinearspeedcoeffs(!Matched::Main.MultiPro.VortexElement.LinearPanel, !Matched::Main.MultiPro.VortexElement.LinearPanel, ::Any)

Both modules ‘ProfileMod’ and ‘MultiPro’ use the ‘VortexElement’ module but there seems to be a mismatch since ‘MultiPro’ also uses ‘ProfileMod’.

It looks like you’re probably calling include() on the same file multiple times, which is resulting in multiple different copies of the VortexElement module. You essentially never want to include the same file more than once in Julia. Fortunately, this is generally very easy to solve, although I can’t make a precise suggestion without some idea of what your code looks like. For more discussion, see I'm confused with types names


Loading the module with using from a package could work in most cases.

I’ve struggled with this exact problem. The solution for me was trivial, but difficult to find online. I discovered it through persistent experimentation. It seems that I’ve stumbled upon a sound approach, but I’m not qualified so say for sure.

Here’s how I deal with the issue. I include each file (containing modules and structs) of interest only once, in say module “MyStartModule”. This brings their content into Main.MyStartModule, as far as I gather. And that’s where I retrieve their modules and structs from when using in other files. This seems to solve the problem and bring consistency to my types.

That call looks something like this “using .Main.MyStartModule.SomeModuleThatWasIncludedByMyStartModule”.