using bisect but still failing I managed to use the bisect operator from a python script like this:

bpy.ops.mesh.bisect(plane_co=(curx, cury, curz+dz),
                    plane_no=(0, 0, 1),
                    use_fill=False,
                    clear_inner=False,
                    clear_outer=False,
                    threshold=0.0001,
                    xstart=0,
                    xend=0,
                    ystart=0,
                    yend=0,
                    cursor=1002)


It works but nothing works after such in the script.
To make it work I need to be in edit mode and have the mesh already selected.
(if someone can also explain how to just change to edit mode and do a select all, or even how to select the part I want even better)
it's almost as if this command is clearing the selection so it does not work anymore.
Do i need to wait for some process or update something before using the same command (with other parameters of course)?
Using bmesh

rather than drive yourself nuts with trying to use what is basically a UI operator (IMO), can use the bmesh equivalent bmesh.ops.bisect_plane.

Here is a test script, to run while object is in edit mode. It bisects all faces / edges of edit object with a plane at (0, 0, 0) normal z axis, in the meshes local space. 

import bpy
import bmesh
context = bpy.context

# run this in edit mode
ob = context.edit_object
mesh = ob.data
bm = bmesh.from_edit_mesh(mesh)

# select all faces
for f in bm.faces:
    f.select = True

edges = [e for e in bm.edges]
faces = [f for f in bm.faces]
geom = []
geom.extend(edges)
geom.extend(faces)

result = bmesh.ops.bisect_plane(bm,
                              dist=0.01,
                              geom=geom,
                              plane_co=(0, 0, 0),
                              plane_no=(0, 0, 1))
print(result)
bmesh.update_edit_mesh(mesh)


Or alternatively in object mode

import bpy
import bmesh
context = bpy.context
# run this in edit mode
ob = context.object
mesh = ob.data
bm = bmesh.new()
bm.from_mesh(mesh)

# select all faces
for f in bm.faces:
    f.select = True

edges = [e for e in bm.edges]
faces = [f for f in bm.faces]
geom = []
geom.extend(edges)
geom.extend(faces)

result = bmesh.ops.bisect_plane(bm,
                              dist=0.01,
                              geom=geom,
                              plane_co=(0, 0, 0),
                              plane_no=(0, 0, 1))
print(result)
bm.to_mesh(mesh)
mesh.update()


The plane coord and normal passed to the operator are in local space of the mesh. To use global coordinates 

local_coord = ob.matrix_world.inverted() * global_coord


Can change the geom input into the operator

from math import radians
edges = [e for e in bm.edges if e.select] # use selected edges
# faces with a normal orthogonal to z axis
faces = [f for f in bm.faces
               if abs(f.normal.angle((0, 0, 1)) - radians(90)) &lt; 0.001]