---
id: "E:cAlgo.API.FileAssociations.FileOpened"
kind: "event"
type: "T:cAlgo.API.FileAssociations"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/FileAssociation/FileAssociations/FileOpened/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# FileAssociations.FileOpened

Member of [FileAssociations](https://help.ctrader.com/ctrader-algo/references/Plugin/FileAssociation/FileAssociations/index.md).

## FileOpened

Event triggered when a file associated with a registered extension is opened.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Available to plugins only, and plugins cannot run in the CLI.
- Cloud: Available to plugins only, and plugins cannot run in the cloud.

C#:

```csharp
event Action<FileAssociationsFileOpenedEventArgs> FileOpened;
```

Python:

```python
api.FileAssociations.FileOpened += handler  # handler(obj: FileAssociationsFileOpenedEventArgs)
```

### Returns

`Action<FileAssociationsFileOpenedEventArgs>` — 

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
protected override void OnStart()
{
    FileAssociations.Add(".mydata");
    FileAssociations.FileOpened += OnFileOpened;
}

private void OnFileOpened(FileAssociationsFileOpenedEventArgs args)
{
    Print("User opened file: {0}", args.FilePath);
}
```

Python:

```python
def on_start(self):
    api.FileAssociations.Add(".mydata")
    api.FileAssociations.FileOpened += self.on_file_opened

def on_file_opened(self, args):
    api.Print(f"User opened file: {args.FilePath}")
```

