How to test if an object exists


(Mighty_Cow) #1

How do I run a check to see if an object exists in python?


(CoDEmanX) #2

like to check for an object by name?

if bpy.data.objects.get("ObjectName") is not None:
    print("found object")

(Mighty_Cow) #3

Thanks Very much!


(Richcolburn) #4

Slightly faster:

found = 'ObjectName' in bpy.data.objects