bsurfaces gpl edition , script version throwing an error
Unlike 

bpy.ops.gpencil.surfsk_add_surface(edges_U=50, edges_V=20, cyclic_cross=False, cyclic_follow=False, loops_on_strokes=True, automatic_join=True)


this 

bpy.ops.gpencil.surfsk_add_surface('INVOKE_DEFAULT')


this works from script as well 

but one drawback is we will not be able to pass edges_U &amp; edges_V from code

for that I modified the addon itself in line 2970

self.edges_U = bpy.context.scene.edges_U
self.edges_V = bpy.context.scene.edges_V


I do the required calulcations and store them in bpy.context.scene &amp; assign them in the addon code.

Hope this temporary hack can be used until the original authors fix the addon.