Dual axis in dynamic graph

Hello everyone

fig=go.Figure()
cols=['NO2 mug/m^3','NO mug/m^3']
for idx,col in enumerate(cols):
    for df in [ag,snd]:
        fig.add_trace(go.Bar(x=df['Date'],y=df[col],
                             name=f'{str(df.Municipality.unique()[0])} {col}'))
        #fig.add_trace(go.Bar(x=ag['Date'],y=ag['NO mug/m^3']))
        fig.update_layout(barmode='group',xaxis=dict(title='Date'))
       # print(df)
fig

In this snippet i take two columns (which are common in both dataframes) and use a bar chart which give me the following result

in this phot we get 4 distinct bars that do not overlay.
what i want is to keep this format but to also add a second y axis.
But beacuse of the dynamic nature that this format will be used i want it to be versatile.
When lets say we have one column ( NO mug/m^3) to not have the second axis.

From what i tried i got something like te following


which is not desireable. is there any way to keep the format of my first image while using some condition in order to achive my second axis?

thank for your patience