# jq Module Search Order: How the jq Linker Resolves `import` Statements

> Understand jq module search order. Learn how the jq linker resolves import statements with a six-step priority including current directory, -L flags, JQ_LIBRARY_PATH, $ORIGIN and importing module location.

- Repository: [jqlang/jq](https://github.com/jqlang/jq)
- Tags: internals
- Published: 2026-04-11

---

**The jq linker resolves module imports by searching directories in a strict six-step priority, starting with the current working directory, then checking paths specified by `-L` flags or `JQ_LIBRARY_PATH`, followed by `$ORIGIN` substitution, and finally resolving relative to the importing module's location.**

When writing complex jq programs, organizing code into reusable modules is essential. Understanding the **jq module search order** ensures your `import` and `include` statements resolve correctly across different environments. This behavior is implemented in the `jqlang/jq` repository,