Arc modules
Write Arc code one time in a module, and import it into your automations.
A module is Arc code that automations and other modules import. A module has no Driver and does not run by itself.
Create a module
- In the Arcs toolbar, click Create Arc automation ().
- Type a name, and select the Module type. The name can contain only letters, digits, and underscores.
- Click Create.
Export code
Put export before a top-level function, sequence, stage, or := variable. Importers
see only exported code.
export func psi_to_kpa() {v f64} f64 {
return v * 6.895
}
export sequence press {
stage fill {
1 -> press_vlv_cmd
tank_pt > 300 => next
}
stage hold {
0 -> press_vlv_cmd
}
}
export stage vent {
0 -> press_vlv_cmd
1 -> vent_vlv_cmd
}Import a module
The import path is the directory names and the module name, joined by .. This
automation imports the module tank from the directory lib:
import lib.tank
tank_pt -> tank.psi_to_kpa() -> tank_pt_kpa
start_cmd == 1 => tank.press
abort_cmd == 1 => tank.ventAn import can also use an alias or a group.
Edit a module
The controls bar shows “Compiled” or “Failed to compile” with the error.
A running automation keeps the module code that it started with until you redeploy it.
If you rename, move, or delete a module, each import of the old path fails with
unknown module "lib.tank".