"bpy.context.scene.object_bases" not working in 2.80? The 2.8 documentation for the context override is found here:
https://docs.blender.org/api/blender2.8/bpy.ops.html?highlight=object_bases

override['selected_bases'] = list(bpy.context.scene.object_bases)


is even listed there, but throwing

bpy.context.scene.object_bases


into the python console throws:


  Traceback (most recent call last):
   File "", line 1, in 
  AttributeError: 'Scene' object has no attribute 'object_bases'


I want to merge objects as described by CodemanX here:
How to join objects with Python?
It worked in 2.79, doesnt in 2.80 and throws:


  AttributeError: 'Scene' object has no attribute 'object_bases'


My code snippet:

    proxyname = "ProxyName"
    # create empty new object
    proxymesh = bpy.data.objects.new(proxyname, bpy.data.meshes.new(proxyname))
    bpy.context.collection.objects.link(proxymesh)
    proxymesh.matrix_world = bpy.context.active_object.matrix_world
    # make new, flattened object from all meshes in selection
    duplicants = []
    duplicants.append(proxymesh)
    for obj in bpy.context.selected_objects:
        if obj.type == "MESH":
            duplicant = bpy.data.objects.new("duplicant", obj.to_mesh(bpy.context.depsgraph, True, calc_undeformed=False))
            bpy.context.collection.objects.link(duplicant)
            duplicant.matrix_world = obj.matrix_world
            duplicants.append(duplicant)
    # attach flattened objects to empty object
    ctx = bpy.context.copy()
    ctx['active_object'] = proxymesh
    ctx['selected_objects'] = duplicants
    ctx['selected_editable_bases'] = [bpy.context.scene.object_bases[duplicant.name] for duplicant in duplicants]


So basically, I would like to know how to be able to iterate through the scene's object bases in 2.80?
Appears no need for bases in 2.8  join operator override.

Testing this in python console. Have duped the default cube 3 times, the last dupe "Cube.003" is active and only object selected.

&gt;&gt;&gt; C.object
bpy.data.objects['Cube.003']


&gt;&gt;&gt; C.selected_objects
[bpy.data.objects['Cube.003']]


A list of all the mesh objects in scene to join

&gt;&gt;&gt; obs = [o for o in C.scene.objects if o.type == 'MESH']
&gt;&gt;&gt; obs
[bpy.data.objects['Cube'], bpy.data.objects['Cube.001'], bpy.data.objects['Cube.002'], bpy.data.objects['Cube.003']]


Make a context override dictionary, with only object, active_object, selected_objects, selected_editable_objects as members (possibly don't require "object")

&gt;&gt;&gt; c = {}

&gt;&gt;&gt; c["object"] = c["active_object"] = C.object
&gt;&gt;&gt; c["selected_objects"] = c["selected_editable_objects"] = obs


Run the operator with this override

&gt;&gt;&gt; bpy.ops.object.join(c)
{'FINISHED'}


Resulting scene after running.  All four cubes are joined as one "Cube.003"

&gt;&gt;&gt; C.scene.objects[:]
[bpy.data.objects['Lamp'], bpy.data.objects['Camera'], bpy.data.objects['Cube.003']]


Risky look at obs since three of the objects no longer exist.

&gt;&gt;&gt; obs
[&lt;bpy_struct, Object invalid&gt;, &lt;bpy_struct, Object invalid&gt;, &lt;bpy_struct, Object invalid&gt;, bpy.data.objects['Cube.003']]


Related

poll() failed, context incorrect? - Example: bpy.ops.view3d.background_image_add()

Scripting -- Can&#39;t figure out how to use correct contexts?

Reliable way to find out the required context for an operator?

How to find an operator&#39;s source code?