Hopper
Projects

Modules

Import a file’s module by its package and path.

Create two files in the same package. The import gives the module a short name, and :: selects its declaration.

src/main.hop
import "demo:math";

fn main() -> i32 {
    return math::Value();
}
src/math.hop
fn Value() -> i32 { return 42; }
terminal

hopper run demo src

Use hopper run demo src. For native projects, hopper build-project follows local dependencies from hopper.toml.