You can hire a lawyer when you are questioned by the investigation agency, but at this time, the lawyer is not a defender, but an identity that provides legal help. When you enter the court trial stage, you are the defender.
If you are likely to be sentenced, of course, it is best to hire a lawyer, and the sooner you ask, the better.