How can I setting OperatorStrokeElement?
Try to use
def context_override():
    for window in bpy.context.window_manager.windows:
        screen = window.screen
        for area in screen.areas:
            if area.type == 'VIEW_3D':
                for region in area.regions:
                    if region.type == 'WINDOW':
                        return {'window': window, 'screen': screen, 'area': area, 
'region': region, 'scene': bpy.context.scene} 

bpy.ops.sculpt.brush_stroke(context_override(), stroke=strokes)

where &quot;strokes&quot; is a list of viewport coordinate-tuples, like [(0,0,1),(0,0,-0.5),...]
Source is here.