Context becomes a Nonetype object when called by a custom panel
I resolved my problem finally, 
i'm just going to share the solution in case of someone has the same issue

the error was coming from the definition of the parent bone and the child one. Because I am in edit mode, I have to define them in the armature and not in the object. 

So instead of

pbone = bpy.context.object.data.edit_bones['%s'%parent]


the correct code is 

amt = bpy.data.armatures['PLATFORMAmt']    
pbone = amt.edit_bones['%s'%parent]