---
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."
---

# 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/latest/using-k6/test-lifecycle/).

Expand table

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