The error message indicates that plotted_artists['DQ2PHYS'].colorbar is None, which means that the colorbar attribute does not exist for the plotted_artists['DQ2PHYS'] object.
When you use add_colorbar=True with the plot method of an xarray object, the colorbar is added to the axes, but it is not stored as an attribute of the returned object. Instead, you can access the colorbar through the axes object.
Here's how you can modify your code to access the colorbar:
plotted_artists['DQ2PHYS'] = nn_diff_DQ2PHYS.plot(ax=axs[1,0], add_colorbar=True, cmap='RdBu_r', vmin=var_settings['DQ2PHYS']['vmin'], vmax=var_settings['DQ2PHYS']['vmax'])
cbar = axs[1,0].collections[0].colorbar
cbar.ax.yaxis.set_major_formatter(ticker.FuncFormatter(lambda x, pos: f"{x:.1e}"))
plotted_artists['DQ3PHYS'] = nn_diff_DQ3PHYS.plot(ax=axs[1,1], add_colorbar=True, cmap='RdBu_r', vmin=var_settings['DQ3PHYS']['vmin'], vmax=var_settings['DQ3PHYS']['vmax'])
cbar = axs[1,1].collections[0].colorbar
cbar.ax.yaxis.set_major_formatter(ticker.FuncFormatter(lambda x, pos: f"{x:.1e}"))
However, this approach assumes that the colorbar is the first collection in the axes, which might not always be the case.
A more reliable approach is to use the cbar_kwargs argument to pass a dictionary of keyword arguments to the colorbar function, as I mentioned earlier:
plotted_artists['DQ2PHYS'] = nn_diff_DQ2PHYS.plot(ax=axs[1,0], add_colorbar=True, cmap='RdBu_r', vmin=var_settings['DQ2PHYS']['vmin'], vmax=var_settings['DQ2PHYS']['vmax'],
cbar_kwargs={'format': ticker.FuncFormatter(lambda x, pos: f"{x:.1e}")})
plotted_artists['DQ3PHYS'] = nn_diff_DQ3PHYS.plot(ax=axs[1,1], add_colorbar=True, cmap='RdBu_r', vmin=var_settings['DQ3PHYS']['vmin'], vmax=var_settings['DQ3PHYS']['vmax'],
cbar_kwargs={'format': ticker.FuncFormatter(lambda x, pos: f"{x:.1e}")})
This approach ensures that the colorbar is formatted correctly, regardless of its position in the axes.