Custom Properties?

I cant seem to find a way add custom properties to an object.

Right now I am using

bpy.types.Object.CustomProp

However this doesn’t work the way I want it to work.

What I want is to add custom properties to all selected objects. Properties that I can see, and change.

Help is very much appreciated.
Ex.

Try…

myObject["myCustomProperty"] = myValue

The opposite to fetch the value.

myValue = myObject["myCustomProperty"]

Will throw error if property does not exist so protect with try/except.

Oh wow, I never thought of doing that, its almost identical to the BGE.

Thanks
Ex.