MS, I used to do just that, have a baby gate across the kitchen door so I didn't trip up over my (two) puppies

Babies 'get' object permanence, ie realising you haven't vanished forever when they can't see you, at around 18 months, and you know they've understood it when they will pull a blanket off a toy they've watched you hide underneath it.
Same for a pup I guess, but I don't know at what age. Until they're old enough to get this, they will be unhappy when you're out of sight. Once they get it, you can train them to tolerate it, and that you come back, with the way of 'popping upstairs' or outside for 10 mins at a time