bpy.context.selected_objects: Context object has no attribute "selected_objects"
The context is dependent on quite a number of things, and not every context holds the scene's set of selected_objects. A safer and more consistent way to get the selected objects is this:

selected_objects = [ o for o in bpy.context.scene.objects if o.select ]