If, previous to the commencement of any trial before a justice of the peace, the defendant, his or her attorney or agent, shall make and file with the justice an affidavit that the deponent believes that the defendant cannot have an impartial trial before such justice, it shall be the duty of the justice to forthwith transmit all papers and documents belonging to the case to the next nearest justice of the peace in the same county, who is not of kin to either party, sick, absent from the county, or interested in the result of the action, either as counsel or otherwise. The justice to whom such papers and documents are so transmitted shall proceed as if the suit had been instituted before him or her. Distance, as contemplated by this section, shall mean to be by the nearest traveled route. The costs of such change of venue shall abide the result of the suit. In precincts, and incorporated cities and towns where there are two or more justices of the peace, any one of them shall be considered the next nearest justice of the peace.