To stretch any muscle, you must move the joint(s) that it crosses in the opposite direction. So, to stretch the hip flexors you need to just put your leg back and go into hip extension, correct?
WRONG! Our 1-joint hip flexors, called the iliopsoas, perform other muscle actions in addition to hip flexion. The iliopsoas also anteriorly tilt the pelvis, externally rotate the femur, and sidebend the spine in the ipsilateral or same direction. This means that in order to properly stretch your iliopsoas, you must perform ALL of its opposite muscle actions: hip extension, posterior pelvic tilt, internal rotation of the femur, and contralateral or opposite side bend.
One of the biggest mistakes people make when stretching their hip flexors is forgetting to posteriorly pelvic tilt FIRST, BEFORE extending the hip. Posterior pelvic tilt is the KEY to successfully and adequately stretching your hip flexors. Without a posterior pelvic tilt, you might not even feel a stretch in your hip flexors. Many times, just adding a posterior pelvic tilt with hip extension is more than enough to feel a great stretch of the iliopsoas, even without adding external rotation of the femur or contralateral sidebend. The posterior pelvic tilt movement is similar to that of a thrusting motion. To help get the motion of a posterior pelvic tilt down, I like to tell my patients to pretend they have a tail and that they must tuck their tail underneath their legs.