How is it an obvious solution if it is not practical?
The electronically-scanned radars mentioned in the second answer can easily divide their time between the tasks (no mechanically-constrained dish to sweep) but there is definitely no space for two radar systems in the nose of a fighter.