When we were in our house, we had a compost bin in the backyard. Long story, short .. racoons became attracted to it - then, they climbed up and got into our attic.
We had to stop putting food scraps (vegetable peelings, etc) into the compost, and used it for grass clippings and weeds, only.