Getting an Objects Name with Python


(TankCoder) #1

Hey all,

I have a slight problem. I have an object and I have a script connected to this object with an always sensor. Now, what I need is for this script to get the name of the Object of which it is connected to. Is this possible?


(saluk) #2

object.getName() returns the name. Beware, the first two characters refer to the objects type. A mesh would return “MEname” an actual object returns “OBname”. If you only need the name and not the type, you can use object.getName()[2:]


(TankCoder) #3

Thanks a bunch Saluk.