Modern Nepal was never a part of India, In fact, in the past Nepal was not even a single country.
Yes, Nepal was Divided among several kingdoms and lands, Similar to India which was Divided into thousand of different kingdoms until 1947.
Was Nepal a part of India?
Nepal as a whole country was never a part of Modern as well as Medival India, But Some Texts and Facts suggest that some of
or maybe a lot of Modern-day Nepal were a Part Historic kingdoms of India.
Source : TImemaps.com
Ashoka built Lumbini Piller during 3rd BCE and Expanded the Buddhism Current Easter India and Nepal, which means that during Maurya Empire, at least Some part of Current Nepal was under Bharatwarsh.
And rest part was under Tibet Empire. [ Above Image is Reference to Tibet Empire, in Medival Era | Source- Wikipedia.]
After Maurya Empire Medival Bharatwarsh was decentralized and the states were separated into different states, Nepal was also separated into dozens of Kingdoms.
In 19th Century Nepal was United as a Country to defend itself from Britishers, and Today's Nepal was FIrst Formed, Nepal was never colonized by britishers but was used as the mediator between East India Company and China trade.
After Many Result-less Wars between Britishers and Nepal, In 1925 a Treaty was signed between Nepal and Britishers which Declared Nepal as a Country and Agreed that Britishers will never attack or colonized Nepal.