delete object from all scenes

I’ve been looking for ways to remove objects from all scenes at once but haven’t found any so I’ve written a small add-on that takes care of the job. The script can be installed like any other add-on. Once activated it adds a panel (containing one button) to the toolshelf; pressing the button will remove all selected objects from all scenes.

Ideally I’d like the button to appear in the Object Tools panel instead of in its own panel. Also it would be neat to assign a shortcut (for example alt-x or shift-x) to the function; any hints regarding those improvements will be appreciated.

import bpy

bl_info = {
    "name": "Delete From All Scenes",
    "description": "This will delete an object from all scenes rather than just from the current one.",
    "author": "Abel",
    "version": (0,1),
    "blender": (2, 5, 9),
    "api": 40791,
    "location": "Object Tools > Delete From All Scenes panel > Delete from all scenes",
    "warning": "", # used for warning icon and text in addons panel
    "category": "Object"}

## interface ##

class DeleteFromAllScenesPanel(bpy.types.Panel) :
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_context = "objectmode"
    bl_label = "Delete From All Scenes"

    def draw(self, context) :
        TheCol = self.layout.column(align = True)
        TheCol.operator("object.delete_from_all_scenes", text = "Delete From All Scenes")
# end interface class

## operator ##

class DeleteFromAllScenes(bpy.types.Operator):
    bl_idname = "object.delete_from_all_scenes"
    bl_label = "Delete Object From All Scenes"
    bl_options = {"UNDO"}
    ## actual function ## 
    def invoke(self, context, event):
        for i in range (0,len(bpy.context.selected_objects)):
            current_object = bpy.context.selected_objects[0]
            # unlink object from all scenes
            for sce in
                try:    sce.objects.unlink(current_object)
                except:    pass
        return {"FINISHED"}
    # end invoke
# end operator class

def register():
def unregister():

download link:

Hi abelabel,

this addon is very useful! Thanks for that!

Hmm…there does seem to be some flaws in your logic. From reading the code it will only delete objects in scenes that are selected in a given scene, correct? Is that the intention? Also unlinking is not the same a deleting.

Here is how I would unlink and delete from memory all objects in the entire BLEND file.

import bpy

for scene in
    for ob in scene.objects:

Unlink and remove can fail and generate errors that you will need to trap for (as you have done in your above code) but this small code snippet is more inline with your original stated intention.

Wow, I hadn’t expected any replies on this after all this time. With recent versions of Blender, the delete command has a “Delete Globally” option which does what I wanted to do, so the script should no longer be necessary.

@Atom: thanks for the comments! I wasn’t aware of the .remove functionality, I’ll make sure to use it if I need to remove objects through a script again. As to only deleting selected objects, that is intentional although I can see my intention being ambiguous from the way I formulated it in my original message.

Yep, I already noticed that, but when I searched on the google, I first found your addon :). I also didn’t check how old this thread is…

Yup, and the hotkey is Shift+X ( very handy )

Any way to delete globally a material? Meaning delete from all objects using that material.

Hay friend,
I am also having the same problem. Please give some suggestion and ways about to delete the materials. If you are having any idea to dot this. I am waiting for you suggestion. What is the best way for removing the objects from screen?