A justice of the Supreme Court or judge of the district court cannot act as attorney or counsel in any court, except in an action or proceeding to which he is a party on the record.