0

I want to make my Project structured and ordered. It looks like that: My Project's structure

In the scraper.py I am importing functions from packages at the same level:

from scripts.scraping.web_scraping.web_scraper import get_data_from_web, COMMON_PLANT_DISEASES_URL
from scripts.scraping.image_scraping.image_scraper import get_data_from_images, IMAGES_PATH
from scripts.scraping.export_excel.export_excel import save_excel

All of the init.py contain according lines:

from . import export_excel
from . import image_scraper
from . import web_scraper

I tried using relative imports:

from .web_scraping.web_scraper import get_data_from_web, COMMON_PLANT_DISEASES_URL
from .image_scraping.image_scraper import get_data_from_images, IMAGES_PATH
from .export_excel.export_excel import save_excel

however I get the ImportError: attempted relative import with no known parent package error.

EDIT I added init.py to all scripts subfolders, including the scripts folder:

Edit_v1

But still I get the same error while trying the relative import. How can I solve this issue?

Filip Szczybura
  • 407
  • 5
  • 14

0 Answers0