---
id: "M:cAlgo.API.Frame.Attach"
kind: "method"
type: "T:cAlgo.API.Frame"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Chart/Frame/Attach/"
---

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

# Frame.Attach

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

## Attach()

Attaches frame to main chart container.

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
bool Attach()
```

Python:

```python
frame.Attach() -> bool
```

### Returns

`bool` — True if successful otherwise false

### Examples

C#:

```csharp
var chartFrame = ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour);
chartFrame.Detach();
Print("Attached back to main container: {0}", chartFrame.Attach());
```

Python:

```python
chartFrame = api.ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour)
chartFrame.Detach()
api.Print(f"Attached back to main container: {chartFrame.Attach()}")
```

## Attach(ChartContainer targetContainer)

Attaches frame to passed chart container.

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
bool Attach(ChartContainer targetContainer)
```

Python:

```python
frame.Attach(targetContainer: ChartContainer) -> bool
```

### Parameters

- `targetContainer` (`ChartContainer`, Python `ChartContainer`): Target chart container

### Returns

`bool` — True if successful otherwise false

### Examples

C#:

```csharp
var firstFrame = ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour);
firstFrame.Detach();
var secondFrame = ChartManager.AddChartFrame("GBPUSD", TimeFrame.Hour);
Print("Moved to detached container: {0}", secondFrame.Attach(firstFrame.ChartContainer));
```

Python:

```python
firstFrame = api.ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour)
firstFrame.Detach()
secondFrame = api.ChartManager.AddChartFrame("GBPUSD", TimeFrame.Hour)
api.Print(f"Moved to detached container: {secondFrame.Attach(firstFrame.ChartContainer)}")
```

