When I walk Bonnie (we live out in the sticks, so we walk in the road, no sidewalks) and a car is coming, I say "Bonnie a car is coming" and we move to the side of the road and watch the car go by.
If she even acts like she wants to run after the car I repremand her with a sharp "NO" and a gentle tweek on her leash (attached to her harness).
I would never let her loose, but I hope that if she ever does escape, she will know to get out of the road....May be wishful thinking.