I am a scientist from India. I got an invitation to visit Germany for 2 months (September-October) and France for 2 months (November-December). Will it be prudent to apply for German national visa?
You cannot stay two months in France and two month in Germany on a Schengen visa, because you would exceed the 90-day short-stay limit. You therefore need a national visa but I am not sure exactly which one. It would be easier if one of the stays was longer than the other (and ideally longer than 3 months) or if you would go back to India for a couple of months in-between. For as it stands, neither country has any reason to consider your stay as anything else than a short-stay doable on a Schengen visa.
If you have at least one national visa, you should be fine, either using it to cover both stays (if the duration is right) or together with a Schengen visa for the other stay. What I would do is apply for two national visas (one from France and one from Germany), stressing that the overall length of the stay precludes using a Schengen visa.
If you get both and they overlap or somehow cover the whole stay, you have lost nothing. Worse case scenario is a consulate declining to process the application and inviting you to apply for a Schengen visa instead based on the duration of stay. Do join a letter explaining the problem to the application and, if you can managed to get around the third-party visa processing service, try to get in touch with the consulate directly.
Do note that the time to get this sorted out is running out, you need to apply ASAP. Also, ask your contacts in the French and German universities/research centres if they can get some assistance from their international relations office or something like that.