How to ignore backfaces when doing a raycast?
Did it. I did not even bother if front or backface was hit because the first hit is always backface, so i just added a small offset to the hit vector (depending on view vector) and used it as new origin for a second raycast.

ray_origin_offset = mathutils.Vector((0, 0, 0))
if view_vector[0] &lt; 0:
    ray_origin_offset[0] = -0.0001
else:
    ray_origin_offset[0] = +0.0001
if view_vector[1] &lt; 0:
    ray_origin_offset[1] = -0.0001
else:
    ray_origin_offset[1] = +0.0001
if view_vector[2] &lt; 0:
    ray_origin_offset[2] = -0.0001
else:
    ray_origin_offset[2] = +0.0001          
ray_origin = hit + ray_origin_offset
ray_target = ray_origin + view_vector
hit, normal, face_index = obj_ray_cast(obj, matrix)