import("a")
Imports module a, or loads and runs file a.
If a is a file name (i.e. a Ra file), it is loaded, parsed and executed.
If a is a directory name (i.e. a module name), it does the following:
- creates a namespace a so items within the module can be referenced via the prefix
a. - loads any persisted relvars from
htmlfiles inside the module directory - loads and executes any
init.rafile inside the module directory
Some modules are built-in, e.g. os, maths, http, date.
Others can reference directory names on disk that contain init.ra files.
Examples
built-in
import("maths")
print(maths.tau)
6.28
built-in alternative
import("math")
print(math.tau)
6.28
Run a Ra program
import("test1.ra")