There could be a variety of reasons why it's not eating. You don't give enough information to really pinpoint what the issue is.
Here are some basic questions that would help us focus on the issue for you:
Have you changed its environment at all (changed temp, humidity, substrate, cage or cage location, etc.) recently?
How old is the animal/what size is the animal?
What size prey item are you feeding it? Did you change the size of the prey?
You said it was eating when placed in a smaller cage with just the food item. Did you stop doing that?
Those are just a few Q's to help figure out the issue!
Dave

DNS Reptiles