I know that one can create a layout and set the various elements there in programmatically using pyqgis (See e.g. Print Layout Items. setExtent() and attemptResize()).
But in my application, I have a saved complex layout with multiple sub-figures/maps, which was created manually with QGIS 3 (as of 3.22). I can access it from the menus at Project -> Layout Manager and then show. And I can then print it. I tried but didn't find good examples of how to do such complex layouts in Python (and I didn't want to repeat the labor either).
How can one using PyQGIS to print map using a saved layout to an image file (.png)?