Removing constraint ID problem

Hi guys, I am half way though making a crane simulator in the blender game engine (blender v2.69) and I am having trouble with the removeConstraint() function. I think this is down to not being able to properly get the ID of the constraint I made by pressing the ‘H’ key. Creating the constraint works fine but it throws an error on the line ‘const1_ID = const1.constraint_id’. Apparently the const1 isn’t defined. Does anyone know how to resolve this issue?

Here is the code that I’m testing:

from bge import logic
from bge import constraints

keyboard = bge.logic.keyboard
JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED

cont = bge.logic.getCurrentController()
own = cont.owner

# get object list
objects = logic.getCurrentScene().objects

object_1 = objects["Hook"]
object_2 = objects["Block"]

# Use ball-joint type constraint
constraint_type = 1

# get Object1 and Object2 physics IDs
physics_id_1 = object_1.getPhysicsId()
physics_id_2 = object_2.getPhysicsId()

# Center-bottom of Object1 for joint position
edge_position_x = 0.0
edge_position_y = 0.0
edge_position_z = -1.0

# use Object1 y axis for angle to point hinge
edge_angle_x = 0.0
edge_angle_y = 0.0
edge_angle_z = 0.0

# create a constraint
if keyboard.events[bge.events.HKEY] == JUST_ACTIVATED:
   const1 = constraints.createConstraint(
                                physics_id_1,
                                physics_id_2,
                                constraint_type,
                                edge_position_x,
                                edge_position_y,
                                edge_position_z,
                                edge_angle_x, edge_angle_y, edge_angle_z)
                   

const1_ID = const1.constraint_id

                                
if keyboard.events[bge.events.JKEY] == JUST_ACTIVATED:
    constraints.removeConstraint(own.constraint_ID)