Yesterday I am trying a simple machine learning project from Udacity. There are bunch of files provided and sometime we have to link one another through importing it. It got me frustrated when trying it repeatedly and still got the same error.
The task is quite simple actually. I just need to import a python file from other folder at the same directory. To make it easy, let see this image.

The main directory is ud120-projects, and inside that folder there are several folders. I have the file that I work on in the naive_bayes folder (red color), and I want to import a file named email_preprcess.py that is located in the tools folder (green color).
When I run the file, I found the following error:

I have repeat the same step several times and still got the same error.
Then I find out that the problem is in the folder where I run the file. I run the file from the main directory. While to be able to import a file, we must run the file from its actual folder (which is the naive_bayes or red folder).
So, the solution to this issue is just go to the terminal and type
cd naive_bayes
And it’s done now. The problem is solved.