CrPC 479: Section 479 of the Criminal Procedure Code
Cases in which Judge or Magistrate is personally interested
No Judge or Magistrate shall, except with the permission of the Court to which an appeal lies from his Court, try or commit for trial any case to or in which he is a party, or personally interested, and no Judge or Magistrate shall hear an appeal from any judgement or order passed or made by himself.
Explanation – A Judge or Magistrate shall not be deemed to be a party to, or personally interested in, any case by reason only that he is concerned therein in a public capacity, or by reason only that he has viewed the place in which an offence is alleged to have been committed or any other place in which any other transaction material to the case is alleged to have occurred and made an inquiry in connection with the case.