Skip to content

Modules & Imports

You can include other Tulpar files using the import keyword. This allows you to reuse code and organize your project.

// Import a file
import "examples/utils.tpr";
// Use functions from the imported file
int result = topla(10, 20);
print("Result:", result);

Imported files share the same global state. Variables defined in an imported file are accessible in the importing file.

// In utils.tpr
float PI = 3.14159;
// In main.tpr
import "utils.tpr";
print("PI:", PI);