Selecting more than one object [with Python]

Hi,

I wrote in Blender 2.57 a code in which two different objects are getting selected:

    bpy.ops.object.select_name(name="Object_1")
    bpy.ops.object.select_name(name="Object_2")

In Blender 2.57 the selection was added to the selection. This means first the code selects sobject_1 and after that object_2. In Blender 2.57 both objects where than in the active selection. (like when you select and hold the shift-key).

In Blender 2.59 I now have the problem, that with this code only 1 Object is selected and NOT added to the selection.
So does anyone know what I have to write in Blender2.59 so that both Objects are getting selected??

Thanks in advance for any help…

Greetings Dechgo

You could use:

bpy.ops.object.select_name(name="Object_1")
bpy.data.objects["Object_2"].select = True

Although, if you need the second object to be the ‘active’ object:

bpy.ops.object.select_name(name="Object_2")
bpy.data.objects["Object_1"].select = True

Hi cnmomoney,

sorry for the late reply…
But thank you very much what you wrote works for me… thanks for your help!

Greetings dechgo