Fig_px "works", but fig is broken

I still don’t understand the issue. Keep in mind, that we do not know anything about your data and how you want the graphs to look like. From coding perspective, there is nothing wrong with the snippet you posted.

Keep in mind that by using px.bar() you create a figure object, i.e the layout is included there. By stripping the data from the figure object and using it in subplots as traces, you are loosing all the information concerning layout.