Perform same action on all selected objects I am trying to write a simple code that should perform the same action on all selected objects in Blender. For example, let's assume that I have two MESH objects in my scene and I want to print the scale along the x-axis of these two &quot;MESH&quot; objects. Here the code:
import bpy
objects = bpy.context.scene.objects
for obj in objects:
   obj.select_set(obj.type == &quot;MESH&quot;)
selected_objects = bpy.context.selected_objects
for cube in selected_objects:
   print(bpy.context.object.scale[0])

The problem is that the code prints twice the same value, which refers to the last selected object (the one with the light yellow border). I can't understand why.
As you noticed, bpy.context.object points to the active object, regardless of the variable in your for loop.
In your last line you are iterating over all selected objects, but you are not actually using the iteration variable afterwards, cube.
Replace the last line with print(cube.scale[0])