Select object from within collection Can anyone tell me how I can choose an arbitrary object from within a collection? My script leaves me with nothing active (or selected) at one point, but I need something to be active.

I have the collection name from this:

Coll = bpy.data.collections.get('Structure')


So I can do something like this:

if Coll:
   for obj in Coll.objects:
       obj.select_set(True)


Which makes each object active one at a time, leaving me with the last one active at the end of the loop. But that seems pretty heavy handed. There must be a neater way.
How does this work?

from random import choice

# deselect all:
for obj in Coll.objects: obj.select_set(False)
# choose one and select it:
rnd_obj = choice(Coll.objects)
rnd_obj.select_set(True)