Reputation: 3018
I have a file calc.py where I have methods for basic calculations.Now I crate another file (in the same directory) called test_calc.py for unittesting the methods in calc.py file.But in the test_calc.py file,when I type import calc, it says 'no such module'.If I am in the same directory,why can't I import calc?
Here is a screen shot of my project structure
This is what I get when I try to import calc into the test_calc.py file
So what is going wrong?
Upvotes: 2
Views: 967
Reputation: 1324827
Try at least, as recommended here
from . import calc
Python 3 doesn't allow implicit relative imports.
Upvotes: 2