Two men have been charged after shots were fired between two cars driving through a Melbourne suburb in the middle of the afternoon.

Dennis Rapovski, 29, of South Morang, and Martin Pieri, 30, of Preston, were charged with offences that include reckless conduct, using a firearm in a town or populous place and using a firearm in a dangerous manner in an out-of-sessions hearing overnight.

Police say there was an exchange of gunfire between two cars in Thomastown just before 3pm (AEDT) on Thursday.

The men will appear in the Heidelberg Magistrate's Court on Friday.

Police say no one was injured in the incident.