This is what immunity in India, a relic of colonial times, looks like:
Section 197, Criminal Procedure Code of India
1) When any person who is or was a Judge or Magistrate or a public servant not removable from his office save by or with the sanction of the Government is accused of any offence alleged to have been committed by him while acting or purporting to act in the discharge of his official duty no court shall take cognizance of such offence except with the previous sanction-...
(a) In the case of it person who is employed or, as the case may be, was at the time of commission of the alleged offence employed, in connection with the affairs of the Union, of the Central Government;
(b) In the case of a person who is employed or, as the case may be, was at the time of commission of the alleged offence employed, in connection with the affairs of a State, of the State Government:
This is not sufficient for the judges (for some reason), so the judges protect themselves by this additional immunity:
Section 77 of the Indian Penal Code:
Nothing is an offence which is done by a Judge when acting judicially in the exercise of any power which is, or which in good faith he believes to be, given to him by law....
Even this is not sufficient (for some reason), so the courts further immunize themselves thus:
K.Veeraswami vs Union of India (Supreme Court of India, 1991)
"No criminal case shall be registered u/s 154 Cr.P.C. against a Judge of the High court, Chief Justice of the High Court or a Judge of the Supreme Court unless the Chief Justice of India is consulted in the matter."