The Code of Criminal Procedure, 1973 (CrPc)
332. Procedure on accused appearing before Magistrate or court..
(1) If when, the accused appears or is again brought before the Magistrate or court, as the case may be, the Magistrate or court considers him capable of making his defence the inquiry or trial shall proceed.
(2) If the Magistrate or court considers the accused to be still incapable of making his defence, the Magistrate or court shall act according to the provisions or section 329, as the case may be, and if the accused is found to be of unsound mind and consequently incapable of making his defence, shall deal with such accused in accordance with the provisions of section 330.