Even though I have a habit of making sure my keys are in my hand when I close the car door. It has happened to me a couple of times when I got distracted.
I know some modern cars can open with your smartphone and some remotes automatically unlock the door when it's near the car. But not everyone has this technology in their cars yet.
One popular safeguard is to carry a spare key in your wallet and that's still a valid safeguard. But most us do have car remotes these days. So here's another safeguard.
Carry your car remote in the same pocket that you carry your keys. But don't attach the remote to the keychain.
This way when you reach in to get your keys. Push the button on the remote to unlock the door but only pull your keys out.
When you exit your car and put your keys away. Push the button on the remote to lock your car doors.
This way you use your keys as you normally do. But your remote never leaves your pocket. So even if you ever do lock the keys in your car. Your remote is still accessable to you.
You could do this with a purse instead of your pocket too. But then you run the risk of locking your purse in your car with the remote. So I still recommend carrying your remote in your pocket.
I hope someone finds this helpful. Enjoy!