How to divide a project into files and submodules?

Should be using ..my_structs — you need .. because it’s being imported by the enclosing module, and you need using because you want to use the unqualified exported symbols.

PS. export is syntax, not a function. You don’t need parens — you can just do export Prod1, Prod2, for example.

PPS. include(".\\my_structs.jl") can just be include("my_structs.jl") — it’s automatically relative to the directory of the current file.

PPPS. In the example here I would generally not bother with submodules at all. There is no need to have a new module for every file, and most projects do not do this. See also Best practise: organising code in Julia - #2 by stevengj

3 Likes