Pantry moths are experts at finding their way into any open container of rice, flour, cereal, chips, nuts, etc. Then they breed in the boxes and bags. I hate it when I open a cabinet and a couple of moths fly out. It’s even worse when I look at a bag of rice, and it is alive with motion.
We’ve been putting our food into wide-mouth mason jars with these convenient one-piece plastic lids. That has reduced the problem. We also started using pantry moth traps. These traps fold into little A-frame houses. The interior is coated with a sticky material that traps the flies. The traps also come with a postage stamp size pheromone lure to fool the pests into thinking a sexy moth is inside waiting for them. These things work well. After using them for a few weeks the only moths I see now are the dead ones stuck to the inside of the traps.