list/loop through object properties?

Just wondering since we can either check:


if 'property' in object:
  pass

or


object['property']

But my question is. What if I don’t know prehand the property’s name and I just wish to check what properties an object might have?
Is there a method for that?

getPropertyNames should be what you’re looking for:

obj ... a KX_GameObject
for name in obj.getPropertyNames():
    propertyValue = obj.get(name)