Walmart’s acquisition of Flipkart has created shockwaves in India, with the realization that the vast majority of its $16 billion price will go to foreign investors, namely Tiger Global, SoftBank, Naspers, and Accel Partners. Now Indian investors are kicking themselves for missing out on the largest e-commerce exit ever. And they have no one to blame but themselves: Flipkart tried very hard to raise money locally but was ridiculed and turned away, forcing it to turn to foreign giants.

This pattern will repeat itself until India’s investors realize that the best opportunities are not in Silicon Valley but at home. Frankly, I sympathize with Flipkart founders Sachin and Binny Bansal, because I too have seen the Indian inferiority complex at work.

In a talk I gave at INK India in 2014, I predicted that a billion Indians would be gaining Internet connectivity through their smartphones within a few years and that this would begin to transform the country. Tens of thousands of startups building health sensors, robots, drones, and commerce and infrastructure tools, and hundreds of thousands of application writers addressing local problems, could solve not only India’s problems, but those of the world.

I also tried educating the executives of Wipro and Infosys. When they told me of the huge funds they were setting up to invest in Silicon Valley, I warned them that no one here cared for their companies or investments; at best, they would be offered bottom-of-the-barrel deals and be left chasing rainbows. And that is largely what has happened.

I live in Silicon Valley and am a professor, not an investor. I did, however, get involved with one Indian startup because it had world-changing potential yet was dying on the vine. Indian investors ridiculed the notion that something of such magnitude could emerge from India; all they did was waste the time of the founders.

The company, HealthCubed, develops a compact medical-grade device that provides more than 40 measures and tests — the same tests that labs and hospitals provide but at a fraction of the cost. It’s exactly the kind of innovation that a country like India — with its many under-equipped rural health clinics — needs.

I rarely have a problem getting Indian executives and VCs to return my emails. Yet when I wrote to them about HealthCubed, most didn’t even respond (this is a common problem in India: rather than saying no, people just don’t respond). Ironically, the investors who did write back said the valuation of the company was too high — without even asking what it was!

So I gave up on India and advised the company CEO Ramanan Laxminarayan to register the business in Delaware and move the intellectual property to the U.S. Then I invested my own savings in the company, as did a number of other high-profile individuals based in the U.S. and a New York–headquartered investment fund.

The product is now being used to help hundreds of thousands of villagers in more than a hundred districts of four states of India as well as in Bangladesh and at U.N. clinics outside the borders of Myammar. And it is set to roll out in Ghana, Senegal, and Nigeria.

Indian entrepreneurs can build this kind of world-changing technology, and it is important for investors to believe in them.

That’s not to say entrepreneurs shouldn’t take some of the blame for the lack of local funding. As Silicon Valley’s Hemant Kanakia said to me in an email: “Part of the problem I have observed while being an investor in Indian startups in the last six years is that Indian entrepreneurs have a short-term outlook. They want to make money and live the lifestyle of the rich. Sachin Bansal had no ambition like founders of China’s Tencent or Baidu have of conquering the world.”

Yet even Silicon Valley was like this when its ecosystem was in its infancy. I’ll bet that as a generation of founders, all over the world, such as the Bansals achieve great success, they too will develop grand ambitions.

Vivek Wadhwa is a Distinguished Fellow at Harvard Law School and Carnegie Mellon University.