I have the following file structure:
main.py
Core/
object_storage.py
setup_logger.py
main.py:
from Core import object_storage
#rest doesn't matter
object_storage.py:
from setup_logger import logger
#rest doesn't matter
setup_logger.py:
import logging
import sys
Log_Format = "%(levelname)s %(asctime)s - %(message)s"
logging.basicConfig(stream = sys.stdout,
format = Log_Format,
level = logging.INFO)
logger = logging.getLogger()
When I run object_storage.py it works perfectly, but when I want to run main.py it gives me the error:
ModuleNotFoundError: No module named 'setup_logger'
I checked os.getcwd() and I think the issue is the working directory remains the root folder where I have main.py when I want to import setup_logger from Core/object_storage.py.
What is the way to solve this?