# Add unique name to data for calling on another part

**URL:** <https://community.plotly.com/t/add-unique-name-to-data-for-calling-on-another-part/62318>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [March 25, 2022, 8:56pm UTC](https://community.plotly.com/t/add-unique-name-to-data-for-calling-on-another-part/62318 "2022-03-25T20:56:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bijan](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/bijan/32/22061_2.png) [@Bijan](https://community.plotly.com/u/Bijan)\
**Post date:** [March 25, 2022, 8:56pm UTC](https://community.plotly.com/t/add-unique-name-to-data-for-calling-on-another-part/62318/1 "2022-03-25T20:56:22Z")

</div>

Hi everyone

Is it possible to have a unique name or id or … to refer to a drawn object. For example in the below code to update any line data, I have to refer them by the order of drawing them. But I need to assign a unique name (for example assign ‘L2nd’ to the second line) then I update the second line data by calling it’s unique name (‘L2nd’). What should I do for this purpose?

```auto
import plotly.graph_objects as go

fig = go.Figure()

# Create scatter trace of text labels
fig.add_trace(go.Scatter( x=[0, 6], y=[0, 1], mode="lines"))
fig.add_trace(go.Scatter( x=[1, 7], y=[0, 1], mode="lines"))
fig.add_trace(go.Scatter( x=[2, 8], y=[0, 1], mode="lines"))
fig.add_trace(go.Scatter( x=[3, 9], y=[0, 1], mode="lines"))

fig.data[0].x=[0, 8]
fig.data[1].x=[2, 5]
fig.data[2].x=[3, 4]
fig.data[3].x=[1, 4]

fig.show()

```

---

<div class="post-metadata">

**Author:** ![akroma](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/akroma/32/20346_2.png) [@akroma](https://community.plotly.com/u/akroma)\
**Post date:** [March 27, 2022, 9:22am UTC](https://community.plotly.com/t/add-unique-name-to-data-for-calling-on-another-part/62318/2 "2022-03-27T09:22:33Z")

</div>

Hey @Bijan,

Please take a look at this link

[https://plotly.com/python/creating-and-updating-figures/](https://plotly.com/python/creating-and-updating-figures/)

" The `update_traces()` method supports a `selector` argument to control which traces should be updated. Only traces with properties that match the selector will be updated."

In your case:

```auto
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter( x=[0, 6], y=[0, 1], name="first_line", mode="lines"))
fig.add_trace(go.Scatter( x=[1, 7], y=[0, 1], name="second_line", mode="lines"))

fig.update_traces(x=[1,5], y=[1,5],selector = ({'name':'first_line'}) )

fig.show()

```

Have a nice day.
