Control custom properties
You can use static custom properties for this;

import bpy

def foo(self, context):
    print("my test function", self)

bpy.types.Scene.testprop = bpy.props.FloatProperty(update=foo)


This will print:

my test function &lt;bpy_struct, Scene("Scene")


When the property is updated, through:

 bpy.context.scene.testprop = 11.0


Note that the FloatProperty function takes the arguments:

FloatProperty(name="", description="", default="", maxlen=0, options={'ANIMATABLE'}, subtype='NONE', update=None, get=None, set=None)


Which are all optional; This does, however mean, that you can define set and get functions for the property.

You can also use StringProperty and BoolProperty

If you want to add it to the UI, in a custom location, use something like:

class myPanel(bpy.types.Panel):     # panel to display new property
    bl_space_type = "VIEW_3D"       # show up in: 3d-window
    bl_region_type = "UI"           # show up in: properties panel
    bl_label = "My Panel"           # name of the new panel

    def draw(self, context):
        self.layout.prop(bpy.types.Scene, "testprop") #Make sure this matches the name you gave to your property.

bpy.utils.register_class(myPanel) 


It will be found under the Scene tab, in the Properties panel, otherwise.

The custom property is basically a field and can be read, programatically, as:

bpy.type.Scene.testprop


And delete them with:

bpy.ops.wm.properties_remove(data_path="scene", property="testprop")




You can check the relevant docs here, and the API here.