You need to specify the context and also make sure the bone is active:
import bpy
pbone = bpy.context.active_object.pose.bones["Bone_name"]
context_copy = bpy.context.copy()
context_copy["constraint"] = pbone.constraints["Child Of"]
bpy.context.active_object.data.bones.active = pbone.bone
bpy.ops.constraint.childof_set_inverse(context_copy, constraint="Child Of", owner='BONE')