---
title: "Init context | Grafana k6 documentation"
description: "The init context (aka \"init code\") is code in the global context that has access to a few functions not accessible during main script execution."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Init context

Before the k6 starts the test logic, code in the *init context* prepares the script. A few functions are available only in init context. For details about the runtime, refer to the [Test lifecycle](/docs/k6/next/using-k6/test-lifecycle/).

Expand table

| Function                                                                      | Description                                          |
|-------------------------------------------------------------------------------|------------------------------------------------------|
| [open( filePath, \[mode\] )](/docs/k6/next/javascript-api/init-context/open/) | Opens a file and reads all the contents into memory. |
