Hello Mark,
When you apply Assign Image command to a polygon, the orthomosaic.patches dictionary is automatically updated with the new element.
Note that using Update Orthomosaic command discards any assigned images (as they are already applied).
You can implement additional checks to skip elements that are not patches, now the code would output assigned images, if any, to all the shapes, skipping not polygonal shapes and shapes that do not have any images assigned:
chunk = Metashape.app.document.chunk
for shape in [s for s in chunk.shapes is s.geometry.type == Metashape.Geometry.Type.PolygonType]:
if shape not in chunk.orthomosaic.patches.keys():
print(shape.label + " shape does not have assigned images, skipping.")
continue
patch = chunk.orthomosaic.patches[shape]
assigned_cameras = list()
for camera in chunk.cameras:
if camera.key in patch.image_keys:
assigned_cameras.append(camera)
print(shape.key, shape.label, assigned_cameras)
print("Script finished.")