When 2 or more persons are charged in the same indictment, whether with the same offence or with different offences, the court may, at any time during the trial, on the application of any of the accused persons, direct that the trial of the accused persons or any of them shall be had separately from the trial of the other or others of them, and for that purpose may, if a jury has been sworn, discharge the jury from giving a verdict as to any of the accused persons.