Origin includes a formal module system that lets you split logic across multipleDocumentation 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.
.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
Bare Import — import <name>
The simplest form loads the entire module into the current namespace under its own name:
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:
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:
Module Resolution
When the interpreter encounters animport statement, it follows this resolution order:
- Built-in aliases — The interpreter ships with a small table of built-in module mappings. Currently,
calcmaps to/lib/calc.or. When you writeimport calc, the interpreter reads and executes that file inline. - Relative
.orfiles — For any other module name, Origin looks for a file named<name>.orrelative to the directory of the currently running script.
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:
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.