A defendant arrested, held, or present in a county other than that in which an indictment, information, felony complaint, or felony probation violation is pending against the defendant, may state in writing his or her agreement to plead guilty or nolo contendere to some or all of the pending charges, to waive trial or hearing in the county in which the pleading is pending, and to consent to disposition of the case in the county in which that defendant was arrested, held, or present, subject to the approval of the district attorney for each county. Upon receipt of the defendant' s statement and of the written approval of the district attorneys, the clerk of the court in which the pleading is pending shall transmit the papers in the proceeding or certified copies thereof to the clerk of the court for the county in which the defendant is arrested, held, or present, and the prosecution shall continue in that county. However, the proceedings shall be limited solely to the purposes of plea and sentencing and not for trial. If, after the proceeding has been transferred pursuant to this section, the defendant pleads not guilty, the clerk shall return the papers to the court in which the prosecution was commenced and the proceeding shall be restored to the docket of that court. The defendant's statement that the defendant wishes to plead guilty or nolo contendere may not be used against the defendant.
Ca. Pen. Code § 1035