Skip to main content


The import_module function imports the symbols from a Starlark script specified by the given locator, and requires that the calling Starlark script is part of a package.

# Import remote code from another package using an absolute import
remote = import_module("")

# Simiarily, you can also import a specific version (e.g. 2.0) of an upstream package using an absolute import
remote_2 = import_module("[email protected]")

# Import local code from the same package using a relative import
local = import_module("./")

def run(plan):
# Use code from the imported module


NOTE: We chose not to use the normal Starlark load primitive due to its lack of namespacing. By default, the symbols imported by load are imported to the global namespace of the script that's importing them. We preferred module imports to be namespaced, in the same way that Python does by default with its import statement.