A prominent Scottish bagpiping school has warned pipers around to world to clean their instruments regularly after one of its longtime members nearly died of a lung infection caused by fungi growing inside his bag.

Highland pipers are fixtures of St. Patrick’s Day parades, and versions of bagpipes are played in many countries, from Sweden to Turkey; even one French Navy band plays them.

John Shone, 77, a Glaswegian, spent a month in the hospital with pneumonia and lost 21 pounds. After antibacterial treatment failed, a doctor told him he was dying, and then asked about his hobbies. When his son brought in his bagpipes, two types of fungi — rhodotorula and fusarium — were cultured.

Mr. Shone acknowledged in a telephone interview that he had not cleaned his bag since being invited 18 months ago to play for a master piper, Donald MacPherson. “It was very remiss of me,” he said. “But pipes have a habit of going badly or going well, and mine were going very well.”