One of the smartest things I ever did was buy a mechanical lockbox, like this one, and place it in my yard.
I made a copy of the house key, and put it in the box. After that, if we ever accidentally got locked out, getting in was a snap.
My kids are wild enough that I could see them locking me out as toddlers, with them in. Or, them following me out and shutting the door.
My door locks have a "safety feature" where they always feel unlocked on the inside, and unless the door is deadbolted, you can always turn the knob and open the door. The manufacturer says it's so that people can always get out in a hurry if there's an emergency. Personally, I think the locksmiths bribed them.
I used my handy lockbox just this morning. I ran outside to throw something away. I didn't bother unlocking the door- I figured I'd just leave the door open since I'd be going outside for 25 seconds or so. Unfortunately, Z was right behind me, and he shut the door behind him, as we've been trying to train him to do.
So. I was outside in my pajamas with a 5 year old. Awesome. Lucky for me, I had my lockbox, and I was back inside within a minute.
Can you imagine what a hassle it would've been if we hadn't put a lockbox in place? We haven't given a housekey to anyone, so I would've had to call J (I DID have my phone with me), pull him out of a meeting 45 minutes away to come home and rescue us.