Upon the trial of a person charged with any of the crimes named and defined in Sections 97-7-45 through 97-7-57, Mississippi Code of 1972, relating to offenses affecting the legislature, a person otherwise competent as a witness shall not be excused from testifying as such concerning the offense charged on the ground that such testimony might criminate him or subject him to public infamy; but such testimony shall not afterward be used against him in any criminal prosecution, except for perjury in giving such testimony, nor shall the punishment of any person for the acts which constitute a violation of either of the said sections by the legislature, or either house thereof, as for a contempt, bar or preclude prosecutions thereunder.