# Функция include

### Описание функции

Позволяет использовать функции, реализованные пользователем в других файлах. Предполагается для написания собственных библиотек.

В качестве передаваемого параметра нужно указать полный системный путь до файла с необходимыми функциями либо имя файла. Во втором случае файл для подключения должен лежать в той же директории, что и основной файл, в котором вызывается `include`.

### Вызов функции

{% tabs %}
{% tab title="other\_file.js" %}
{% code title="other\_file.js" %}

```javascript
// Функции должны быть объявлены как глобальные переменные
sum = function(a, b) {
    return a + b
}
```

{% endcode %}
{% endtab %}

{% tab title="my\_file.js" %}

```javascript
include("other_file.js");
print(sum(1, 2));
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.trikset.com/trik/programming-code/function-include.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
