Al-Shabab militant group, which has intensified attacks to disrupt the elections, claimed responsibility for the latest attack, saying it was targeting the lawmakers.
At least nine people were injured after several rounds of mortar shells hit the parliament building where the newly elected lawmakers were holding a joint session on Monday.
A police officer at the scene said two guards attached to an opposition leader were among those injured at Villa Hargeisa, which is located within the presidential palace in Mogadishu, the capital of Somalia.
"Several mortar shells landed in the vicinity of the parliamentary building, or Villa Hargeisa, located within Villa Somalia," a police officer said.
The shelling happened a few minutes after the lawmakers approved measures to hold elections for the speakers of the House of the People and the Senate on April 26 and 27.
Al-Shabaab group claimed responsibility for the latest attack. The shells struck just as the lawmakers ended their session and were getting out of the building.
"Today's attempt was a cowardly act to frighten the Parliament which is within its constitutional obligation to ensure that the elections are over soon," Somalia's Prime Minister Mohamed Roble said and praised the lawmakers' efforts to race against time to complete the electoral process that will soon culminate in the election of the president.
Over the last weeks, Shabaab militants have staged a series of attacks against delegates to disrupt the electoral process.