Diarrhea is a side effect of intestinal surgery where a part of bowels is resected.
Food passes through the bowels more quickly, the absorption of nutritients and water is impaired, and all of this contribute to diarrhea.
You may also experience a diarrhea as one of the symptoms of blind loop syndrome, that is common complication following abdominal surgery.
This syndrome is related with bacterial overgrowth in bowels, so, I guess, that's why you are finding the drug helpful.
Usually, antibiotic and B12 vitamine are treatment with success, but, when they don't help, surgery is considered for the blind loop syndrome.
You should talk with your surgeon!