0

I'm writing my first project. For some reason, I continue to struggle with importing my own modules. I receive either of these errors:

ModuleNotFoundError: No module named 'src'

ImportError: attempted relative import with no known parent package

I can choose to flatten my project so that all files are within the same folder... but, it seems like bad practice. I would really want to understand how to structure my project so that I can reference packages in other folders.

I will attach my Github repo for reference: https://github.com/mary-vo/my-google-and-yelp-places

The error occurs in this file: https://github.com/mary-vo/my-google-and-yelp-places/blob/main/data-analysis/analysis.ipynb

The following line returns ModuleNotFoundError: No module named 'src':

from src.curated import main

The following line returns ImportError: attempted relative import with no known parent package:

from ..src.curated import main

I found so many examples on Stack Overflow and tried them, but I'm unable to get it to work. For reference, this article

I would appreciate some guidance. I feel very lost.

TechNewbie
  • 164
  • 2
  • 15

0 Answers0