---
id: "E:cAlgo.API.AspBlock.Attached"
kind: "event"
type: "T:cAlgo.API.AspBlock"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Asp/AspBlock/Attached/"
---

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

# AspBlock.Attached

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

## Attached

Occurs when block attached.

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<AspBlockAttachedEventArgs> Attached;
```

Python:

```python
aspBlock.Attached += handler  # handler(obj: AspBlockAttachedEventArgs)
```

### Returns

`Action<AspBlockAttachedEventArgs>` — 

### Examples

C#:

```csharp
protected override void OnStart()
{
    var block = Asp.SymbolTab.AddBlock("My Block");
    block.Attached += OnBlockAttached;
}

private void OnBlockAttached(AspBlockAttachedEventArgs args)
{
    Print("Block attached: {0}", args.AspBlock.Title);
}
```

Python:

```python
def on_start(self):
    block = api.Asp.SymbolTab.AddBlock("My Block")
    block.Attached += self.on_block_attached

def on_block_attached(self, args):
    api.Print(f"Block attached: {args.AspBlock.Title}")
```

