As said in doc Modules and files, modules can be separated into multiple files like
module Foo
include("file1.jl")
include("file2.jl")
end
However there would be one problem, suppose we are developing a module, and would like to separate implementations into data.jl
, func0.jl
and func1.jl
, and data.jl
is for definition of structures, func0.jl
and func1.jl
are some function definitions, using context of data.jl
for multidispatch.
Then it seems the module definition would be
module MyModule
include("data.jl")
include("func0.jl")
include("func1.jl")
end
It works, but the problem is when writing func0.jl
and func1.jl
, we do not have definitions of structures, and auto complete/hints may fail.
If we are using python, we may have file structure
__init__.py
data.py
func0.py
func1.py
and simply use from .data import SomeDataClass
in func0.py
, I’m wondering what’s the correct julia way of dealing with this.