Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/boblio-max/origin/llms.txt

Use this file to discover all available pages before exploring further.

Origin includes a formal module system that lets you split logic across multiple .or files and pull them together cleanly. Three import styles are available — bare import, aliased import, and selective import — each suited to different organizational needs. Modules are themselves valid Origin scripts, so any .or file you write can be imported by another. This page covers all three styles, explains how the runtime resolves module paths, and describes the built-in calc module.

Import Styles

import math_utils

Bare Import — import <name>

The simplest form loads the entire module into the current namespace under its own name:
import math_utils
After this statement, all public names defined in math_utils.or are accessible in the current scope.

Aliased Import — import <name> as <alias>

Aliasing lets you refer to the module by a shorter or more convenient name. This is the recommended style for any module whose name is long or conflicts with an existing identifier:
import math_utils as mu

print mu.square(10)     # → 100
print mu.cube(3)        # → 27

Selective Import — from <module> import <name>

To pull a single name out of a module directly into the current scope, use the from form. After this import, drive can be called without any module prefix:
from robotics import drive

drive(1.0)

Module Resolution

When the interpreter encounters an import statement, it follows this resolution order:
  1. Built-in aliases — The interpreter ships with a small table of built-in module mappings. Currently, calc maps to /lib/calc.or. When you write import calc, the interpreter reads and executes that file inline.
  2. Relative .or files — For any other module name, Origin looks for a file named <name>.or relative to the directory of the currently running script.
Module files are regular Origin scripts — they may declare variables, define functions, and define classes, all of which become available to the importing script after the import is processed.
The module system currently supports one level of namespacing. Deeply nested imports such as from hardware.sensors import Thermometer are not yet supported. Organize your library as a flat collection of .or files until hierarchical namespacing is introduced in a future release.

The Built-in calc Module

The calc module provides common mathematical utilities and is the only module with a built-in path mapping:
import calc

let result: float = calc.sqrt(144.0)
print result    # → 12.0
Because calc resolves to /lib/calc.or, it does not need to be located alongside your script. All other imports must be co-located with the calling script.

Build docs developers (and LLMs) love