Flagyl really hasn't been shown to stimulate appetite in trials. It's actually an irritant in the digestive system and tends to put animals off feed. What it does is kill protozoa. Undiagnosed protozoal infections can certainly be a cause of anorexia in reptiles.
So, people give flagyl, the animal starts eating, and they believe the flagyl gave them back their appetite. Not exactly what's happening.
This is why it doesn't always work, of course. You might as well add in some panacur and do a total parasite clearing, while you're at it. It's hard on the snake to use these worming meds, but if it works, it's because the snake actually had parasites.

Or, assist-feed the snake, obtain a fecal sample, and have the vet do a proper fecal float check to determine if anything's going on. This would be better for the animal than shotgunning it with worming meds. If it has, say, tapeworm--that requires a different medication. So does coccidia. Panacur kills worms, and flagyl kills protoza. So, that's 4 different types of meds (at least). It would be best to use only what's needed.