Bulk forming laxatives can also be used to treat diarrhoea caused by bile salts, I assume you have had resection of the ileum?
If so they work by binding to the excess bile salts before they are ‘dumped’ into the large bowel. It is the presence of excess bile salts in the large bowel that cause the diarrhoea due to the osmotic effect they have. Normally water is drawn out of the large bowel to create firmer stools, when bile salts are present in larger quantities it causes water to drawn into the large bowel which equals diarrhoea.