load
Load a module. Its commands and helpers become available qualified (mod:cmd, @mod:helper); an import list makes selected names available unqualified.
Syntax
Section titled “Syntax”load <moduleName> [imports]Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
moduleName | module | Module name (e.g. aragonos, sim); with --from, name>alias loads the module under a local alias |
[imports] | expression | Import list: [cmd cmd>renamed @helper @helper>@renamed] — names usable without the module prefix |
Options
Section titled “Options”| Name | Type | Description |
|---|---|---|
--from ⚗️ | string | ipfs:// |
Examples
Section titled “Examples”# Load the simulation moduleload sim
# Import selected names for unqualified use (barewords = commands, @names = helpers)load ens [renew @addr]
# Rename an import with >load ens [set-addr>ens-set-addr @contenthash>@ch]The Import List
Section titled “The Import List”After load <module>, every export of the module is available in its
qualified form: commands as <module>:<command> (e.g. ens:renew) and
helpers/constants as @<module>:<name> (e.g. @ens:addr).
The optional import list makes selected exports usable without the module prefix:
- Barewords import commands —
load ens [renew]lets you writerenewinstead ofens:renew. @namesimport helpers and constants —load ens [@addr]lets you write@addr(...)instead of@ens:addr(...).>renames an import —load aragonos [connect>arConn]binds the command asarConn;load ens [@contenthash>@ch]binds the helper as@ch. Renaming only affects the unqualified name: the qualified form keeps the original name (aragonos:connectworks,aragonos:arConndoes not).
load sim [fork expect]load token [@balance]
# Imported commands and helpers work unqualified, including inside blocksfork --using anvil ( sim:set-balance @me 1e18 expect @bool(@balance(ETH @me) > 0))External EVML Modules (--from)
Section titled “External EVML Modules (--from)”load <name> --from ipfs://<cid> fetches an EVML module file from IPFS. The
file must contain exactly one def module command, and the name
it declares must match the name written in the load line — so the load line
always documents which module you are pulling in. Add >alias to bind it
under a different local name (e.g. when two libraries picked the same name):
load math --from ipfs://QmYourModuleCidset $x @math:double(21)
# Load under a local alias — the canonical name stays unboundload math>mylib --from ipfs://QmYourModuleCid
# Import lists work the same as with registered modulesload math --from ipfs://QmYourModuleCid [@double>@dbl]- Only
ipfs://<cid>(and"ipfs://<cid>#<key>") sources are supported — content-addressing pins the exact code you audited, forever. - The pin must be plain text (publish with the
evmcrispr_publish_moduleMCP tool or by uploading the file in the terminal) or a share pin whose script is a module file. Encrypted share links produced bycreate-linkneed their key appended and the source quoted (--from "ipfs://<cid>#<key>"—#starts a comment outside quotes); without the key they are rejected. name>aliasrenames are only valid together with--from— registered module namespaces are never aliased.- External modules may shadow registered-but-unloaded module names (the
editor warns; rename with
>aliasto keep both available). This keeps published scripts working when future built-in modules take the same name. Loading the same local name twice is always an error. - Module defs run isolated: their
setbindings are scope-local and they cannot read or write$mod:keyconfig variables.
- The import list must be a literal array:
load ens [renew @addr]. - Every entry must name an existing export of the module, otherwise the load
fails (e.g.
module ens has no command named foo). - Duplicate imports and imports that collide with an already-imported name or
a
def-defined name are errors — use>to rename one of them. stdis the prelude: its commands and helpers are always available unqualified (they may also be qualified asstd:set,@std:token.amount).
See Also
Section titled “See Also”- std:def — define your own commands and helpers