# T002

> duplicate top-level name

**Severity** Error

Two top-level declarations introduce the same name. Inputs, subscriptions, state, setup values, plots, panes, windows, alerts, types and functions all share one namespace.

Rename one of them so that every top-level binding is unique.

## Failing example

```flowscope
script "Two averages"
data chart = subscribe(data.ohlcv)
plot avg = plot.line(title: "SMA 20", color: color.cyan)
plot avg = plot.line(title: "SMA 100", color: color.violet)
on chart.close {
  avg.plot(ta.sma(chart.close, 20))
}
```

## Fixed example

```flowscope
script "Two averages"
data chart = subscribe(data.ohlcv)
plot fast = plot.line(title: "SMA 20", color: color.cyan)
plot slow = plot.line(title: "SMA 100", color: color.violet)
on chart.close {
  fast.plot(ta.sma(chart.close, 20))
  slow.plot(ta.sma(chart.close, 100))
}
```

## Related

- [T007](/docs/scripting/reference/diagnostics/t007)
- [T011](/docs/scripting/reference/diagnostics/t011)
- [S006](/docs/scripting/reference/diagnostics/s006)
