How to add a vertical line at a specific point with plotly animation?

I’m asking this question because with fig.add_vline it doesn’t work. I’d like to draw a vertical line at the beginning and during the for loop inside the frame.

fig = go.Figure(
data=[go.Scatter(x=trainX_indices[0], y=trainX[0], line=dict(width=10), name='Inputs'), 
      go.Scatter(x=trainY_indices[0], y=trainY[0], mode="markers", marker=dict(size=10), name='Labels'),
      go.Scatter(x=trainY_indices[0], y=trainPredict[0], mode="markers", marker=dict(size=10), name='Predictions'),
      **add_vline(x=2.5, line_width=3, line_dash="dash", line_color="green")],**
layout=go.Layout(
    xaxis=dict(autorange=True, title="Samples"),
    yaxis=dict(autorange=True, title="[\]"),
    updatemenus=[dict(
        type="buttons",
        buttons=[dict(label="Play",
                      method="animate",
                      args=[None]),
                 dict(label="Pause",
                      method="animate",
                      args=[[None], dict(mode="immediate")])           
                ])]
),

frames=[go.Frame(data=[go.Scatter(x=trainX_indices[k], y=trainX[k], line=dict(width=10), name='Inputs'), 
                       go.Scatter(x=trainY_indices[k], y=trainY[k], mode="markers", marker=dict(size=10), name='Labels'),
                       go.Scatter(x=trainY_indices[k], y=trainPredict[k], mode="markers", marker=dict(size=10), name='Predictions')
                       ]) for k in range(train_size)])