import bpy bpy.ops.wm.read_factory_settings(use_empty=True) scene = bpy.context.scene root = scene.collection source = bpy.data.collections.new("SourceCollection") target = bpy.data.collections.new("MoveTargetCollection") root.children.link(source) root.children.link(target) bpy.ops.mesh.primitive_cube_add(location=(1.0, 2.0, 3.0)) obj = bpy.context.object for collection in list(obj.users_collection): collection.objects.unlink(obj) source.objects.link(obj) obj.name = "WBV2P2401Cube" bpy.ops.wm.save_as_mainfile(filepath=bpy.context.scene.get("_wbv2_fixture_path", "tests/files/web/generated/WBV2-P24-001-OBJECT_OPERATIONS.MOVE_COLLECTION.blend"))