Check with your doctor, but I'm pretty sure Imodium is safe to take long term.
This doctor says it's okay:
https://www.iffgd.org/lower-gi-disorders/diarrhea/long-term-use-of-loperamide.htmlCholestyramine might work if your diarrhoea is caused by bile acid malabsorption (quite possible if you've had your terminal ileum removed, as that's where bile acids are absorbed).