# Subprograms

Any program in TRIK Studio can be saved as a subprogram and used in another program.

Subprograms [can be saved](/en/studio/programming-visual/subprograms.md#save) to a local collection or [exported](/en/studio/programming-visual/subprograms.md#export) to a separate file for transfer to other computers.

To work with the collection of subprograms, use the menu item `Tools → Subprograms`:

1. [Export to file](/en/studio/programming-visual/subprograms.md#export).
2. [Import from file](/en/studio/programming-visual/subprograms.md#import).
3. [Save to collection](/en/studio/programming-visual/subprograms.md#save).
4. [Load from the collection](/en/studio/programming-visual/subprograms.md#load).
5. [Clear collection](/en/studio/programming-visual/subprograms.md#delete).

![](/files/-MSiNTsjik8e8YlofGuU)

## Export to file <a href="#export" id="export"></a>

{% hint style="info" %}
Use the export of subprograms to a file to transfer them to other computers. If you plan to use the subprograms on your computer, then use the option [Save to collection](/en/studio/programming-visual/subprograms.md#save).
{% endhint %}

To export subprograms from an open project to a separate qrs file, select `Tools → Subprograms → Export to file` in the main menu.

All subprograms from the current project will be exported to this file.

![](/files/-MSiNYQtANwVxHcN688y)

## Import from file <a href="#import" id="import"></a>

To load previously-stored subprograms, select `Tools → Subprograms → Import from file` in the main menu.

{% hint style="danger" %}
**Attention!** If the imported file contains subprograms with the same names as in the current project, then the subprograms from the project will be replaced by imported ones.
{% endhint %}

## Save to collection <a href="#save" id="save"></a>

{% hint style="info" %}
To transfer subprograms to other computers, use the [export](/en/studio/programming-visual/subprograms.md#export) function.
{% endhint %}

To save routines from the current project, select `Tools → Routines → Save to Collection` from the main menu.

![](/files/-MSiNo7oB2Yq8UG1CXPT)

Then select the subprograms you want to save and click OK.

![](/files/-MSiNsojYMiZe8ct4bo-)

{% hint style="danger" %}
**Attention!** If there are subprograms with the same names in the collection, they will be overwritten.
{% endhint %}

## Load from collection <a href="#load" id="load"></a>

To load subprograms from the collection, select `Tools → Subprograms → Download` from the collection from the main menu.

![](/files/-MSiNxSKr4Ybr-c_mNY9)

Then select the subprograms that you want to import into the current project, and click OK.

![](/files/-MSiO-bIlzZpnjsR5-h_)

## Clear collection <a href="#delete" id="delete"></a>

To delete all subprograms saved in the collection, select `Tools → Subprograms → Clear` collection in the main menu.

{% hint style="info" %}
The collection of subprograms is stored in the user directory and is not lost when uninstalling or reinstalling TRIK Studio.
{% endhint %}


---

# 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/en/studio/programming-visual/subprograms.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.
