Immodium, or generic, is a great tool to minimize diarrhea during that first week of w/d. Only use it for comfort as diarrhea is one of the body's way to detox.
Immodium has an opiate in it called loperamide. But unlike most opiates, it has very little to no effect on the central nervous system (does not cross the blood-brain barrier). Instead it has a strong action on the opioid receptors located along the GI tract. So yes it helps prevent withdrawal related diarrhea well, but it won't have much effect on any overall symptoms of withdrawal.
Physical dependency can be an issue with Immodium over long-term use, but not addiction. So secondary withdrawal really shouldn't be an issue.