Modules and Imports¶
Create a module¶
File: mathx.aja
fuc add(a: int, b: int) -> int:
return a + b
fuc sub(a: int, b: int) -> int:
return a - b
export (
add,
sub
)
Import all from module¶
File: main.aja
import (
"mathx"
)
print(mathx.add(2, 3))
Selective import¶
import (
{add} from "mathx"
)
print(add(10, 5))
Alias import¶
import (
"mathx" as m
)
print(m.sub(7, 2))
Resolution notes¶
Ajasendiri checks module locations in this order:
current file directory
$AJA_VENV/site-packages(if active)parent
.aja/site-packagesglobal
$HOME/.aja/site-packagesdirectories from
AJA_PATH