27rohitb.github.io

Modules

Similar to python. One files containing everything; function, vars, etc for one type of entity.

Key points:

Modules and files <your file>.jl are two SEPERATE things. Modules, is like classes without scopes or security. Here are the key points:

Help sources:

From Here

include is used for including the content of a file into your current program. It has per se nothing to do with modules or namespaces. using and import on the other hand have nothing to do with files, and deal exclusively with modules/namespaces.

Julia Docs links:

Creating modules:

module <mod_name>
  #
  # body
  #
end

Including & USING modules:

include("<mod_FILE_name>.jl")

# 2 different ways to use it
using .<mod_name>
include .<mod2_name>

<var> = <mod_name>.<whatever>

Additionally: using includes export related content of modules into current namespace; i.e no “.” required, just use that var or function natively. as if it were present in current file.