Help for creating a radar sensor with python - bge
Please have a look at the BGE API -> KX_GameObject.rayCast 

Basically you measure the faces an imaginary line is crossing through. 

The mesh of the game object you measure with will be ignored (you want to find another object, rather than itself).

Here is a short demo measuring between [0,-10,0] and [0,10,0]. The coordinates are given in scene space (world coordinates). The direction of the measurement matters as the nearest face to the start point gets returned. The endPosition is a reference where to point to. The measurement will stop after reaching the distance of 15 (regardless the distance to the endPoint).

Code:

import bge

controller = bge.logic.getCurrentController()
owner = controller.owner


startPosition = [0,-10,0] 
endPosition = [0,10,0]
distance = 15

hitObject, hitPosition, hitNormal = owner.rayCast(endPosition, startPosition, distance)

if hitObject:
    print("Object hit:", hitObject, "at", hitPosition, "the normal at that point is", hitNormal)
else: 
    print("hit nothing")


Be aware this is a one-shot. This means you need to call it each time you need to measure. The python solution fits when you need to measure:


only at specific time (rather than all the time)
with dynamic parameters (rather than fixed distance straight forward)
you need to measure multiple times with changing parameters within a single frame
you need settings the ray sensor does not offer (e.g. measure along a reflected imaginary line)


When you just want to "reinvent" the ray sensor, notice it is way easier to use the ray sensor.