A CUE file may import definitions from CUE’s built-in packages and user-defined packages.

The packages required by a file are declared in an import statement at the top of the file, after any package clause. A file does not need to be part of a package to use imports. Multiple import statements are permitted, but it’s good style to use a factored import statement that combines them using parentheses.

An import statement can optionally define a named import, which specifies the identifer that must be used when referencing the imported package inside the file. Named imports can help avoid variable shadowing.

package example

import (
	L "list" // The identifier L must be used.

list: L.Sort([3, 2, 1, math.Pi], L.Ascending)
$ cue export
    "list": [