finding property in an object

does any1 know if there is a python function to see if a property exists in an object

for example when
enemy = ray_sen.hitObject

then i want to check if climb property exists inside enemy. so it would have - enemy[‘climb’]

just using the ray sensor with a property name does not really help me, since i want to use the ray sensor on all objects, but it would act differently if they have a climb property or not

maybe a function that gets the list of all properties would be also useful, if it exists

This checks for the property “climb” in the hitobject, and if it returns True, it runs the function ‘is_enemy()’

enemy = ray_sen.hitObject
if "climb" in enemy:
	is_enemy()
def is_enemy():
	#do whatever here

Here is some code that gets all the object’s properties…

for property in enemy.getPropertyNames():
	#prints the name of the property
	print(property)
	
	#prints the value of the property
	print(enemy[property])

Agoose is correct, except for a line -


enemy = ray_sen.hitObject 
if "climb" in enemy:     
     is_enemy() 
def is_enemy():     
     #do whatever here

Thanks SolarLune :@

Thanks, works grate