Section 302(1) in Bharatiya Nagarik Suraksha Sanhita, 2023
(1)Whenever, in the course of an inquiry, trial or proceeding under this Sanhita, it appears to a Criminal Court,-(a) that a person confined or detained in a prison should be brought before the Court for answering to a charge of an offence, or for the purpose of any proceedings against him; or(b) that it is necessary for the ends of justice to examine such person as a witness, the Court may make an order requiring the officer in charge of the prison to produce such person before the Court answering to the charge or for the purpose of such proceeding or for giving evidence.