I'm building a new home with quite a few pocket doors and would like to know if there is a way for the pantry and utility room lights to come on when the pocket door slides open.
There are some very sophisticated kits that actually use a motion sensor on the slider. These are very very expensive and if you have a problem down the road you are taking out a bunch of drywall. You can go this route.
However a pantry and utility room are closed off smaller spaces. I would just put an occupancy sensor near the door in each room. This will turn the lights on when you open and walk in.