I have found similar questions on SO but none of them seem to give an answer that works for my case.
I have a few modules, in one of them I create a mutable struct which I want to be able to use in the others. All files are at the same level:
- file_module_A.jl
- file_module_B.jl
- file_module_C.jl
In file_module_A.jl:
module A
mutable struct MyType
variable
end
end
In file_module_B.jl:
module B
# I need to import MyType here
end
In file_module_C.jl:
module C
# I need to import MyType here
end
I have tried the followings without success:
- Using directly:
using .A
doesn't work - I can't use:
include("./file_module_A.jl")
in both B and C because when they interact between each other I get the error can't convert from Main.B.A to Main.C.A sinceinclude
includes a copy of the whole code
Any ideas? Thanks in advance!