if bpy.data.objects: ... Would get loop over the entire collection, instead see if this collection has a single item.