Callback error updating overview-filtered.figure

Getting the following error message in my debug:

Callback error updating overview-filtered.figure

UnboundLocalError: local variable ‘fig’ referenced before assignment

Traceback (most recent call last):
  File "C:\Users\name\Code\Project\basic.py", line 282, in create_overview_filtered
    fig2 = px.line(
  File "C:\Users\name\Code\Project\venv\Lib\site-packages\plotly\express\_chart_types.py", line 260, in line
    return make_figure(args=locals(), constructor=go.Scatter)
  File "C:\Users\name\Code\Project\venv\Lib\site-packages\plotly\express\_core.py", line 2170, in make_figure
    fig = init_figure(
  File "C:\Users\name\Code\Project\venv\Lib\site-packages\plotly\express\_core.py", line 2315, in init_figure
    for annot in fig.layout.annotations:
UnboundLocalError: local variable 'fig' referenced before assignment

Here’s the snippet of my callback portion

def create_overview_filtered(selected_sim, selected_time):

    next_event = df_sessions[

                        (df_sessions.SimId == selected_sim) & 

                        (df_sessions.SimulationTime > selected_time)]['SimulationTime'].min()

    dff_ts = df_ts[

                (df_ts.SimId == selected_sim) &

                (df_ts.SimulationTime >= selected_time) &

                (df_ts.SimulationTime < next_event) &

                (df_ts.Attribute.isin(vitals))].copy()

    fig2 = px.line(

                dff_ts,

                x = 'SimulationTime',

                y = 'Value',

                color = 'Attribute', 

                facet_row='Attribute',

                width=1000, 

                height=700

                )

    fig2.update_yaxes(matches=None)

    fig2.update_layout(

        yaxis = dict(title='Value'),

        title = dict(text='Vitals overview until next event'),

        hovermode = 'x'

        )

    return fig2

Edit1: I have other callbacks prior to that but im not sure why it means local variable ‘fig’ if in that function I dont have any fig variables. FYI line 282 starts at fig2 where px.line is being populated