Dear Shabbatshalom white foamy mucousy stool is mainly due to over production of mucus in the large intestine.
It may occur due to pancreatitis pancreatic cancer; liver or bile duct disease; crohn's disease,celiac
disease, food poisoning ,tuberculosis; candida overgrowth in the large intestine; on taking antacids etc. You
should get a stool test, liver function test, test for pancreatic enzymes, done for diagnosis. Get in touch
with a doctor. Take care.