Using .MyModule what is the period for?


I was reading about modules(Workflow Tips · The Julia Language), and saw that one should add with using .MyModule (or import). I was wondering what the period does? Thank you!

1 Like

I’ve never used this, probably don’t worry about it.

1 Like

I see, thank you. Does one always define relative modules?

Like I said, I never have. It’s just one possible workflow.

I see. Could you direct me to an explanation where they explain how to define and refer to non relative modules? Thank you!

You put a module in a file. You source that file using include (or includet from Revise.jl for a smoother development experience). You using that module. Done.

If you’re developing something a bit more reusable, you can use PkgTemplates to generate a standardized directory for it in ~/.julia/dev/MyPackage, and then you use ]dev MyPackage and using MyPackage. Revise is still recommended for this.

Basically the “Revise based workflow” described in your link.

I use this a lot in my code. If you use an Unix system you should be acquainted with . (current folder) and .. (parent folder), this is basically the same thing but for the modules hierarchy instead of a filesystem hierarchy, and scaling with the number of dots (so ... means parent of parent, and so on). If you do not put any dots it is understood that the module comes from a package in the environment and will check the package outer modules. So you use this notation if your package/module divided into many sub-modules and you need to import things between them, what is not very common.


That makes sense, thank you!

1 Like