Fluxon Docs
Guide

Modules (import / export)

Importing batteries and your own files with `use`, aliasing with `as`, exporting with `exp`.

use — import a module

You import the standard library or your own file. There is no installation (install):

use http db ai json        # standard batteries — multiple modules with spaces
use ./tools                # your own file → tools.function

After importing, names live under the module: db.one, http.serve, tools.create_order.

as — renaming (alias)

If your own file has the same name as a battery (for example an ai.fx file and the ai battery), there is a clash. Rename your own module with as:

use ai                     # the battery
use ./ai as helper         # your own file → helper.classify (no clash)

Rule

Do not give your own files battery names (ai db http cron...), or if you do, rename them with as.

exp — export

Expose a function or value from your file to other files:

exp fn create_order items customer
  ...
exp price_limit = 1000

Only things marked with exp are visible from the outside.

See also: the .pkg manifest format for shipping a reusable module with an AI-readable doc.

On this page