Masjid remains Masjid till the Day of Judgement and no way to change it to any other use. We can not change a Masjid to imambargah or to an orphanage or to a school even a religious school. All activities of Imambargah, religious school and helping orphans etc can be done in the Masjid but it remains a Masjid only.
'In some places, Masjid and Imambargah are built together on the same building by making the Qibla side of the building as a Masjid, and the other side as an Imambargah.
'Wassalam.