I have a project structure that looks like:
The file greet.py
is given as:
def greet_morning(message):
print("Hello, {}", message)
def greet_evening(message):
print("Evening message: {}", message)
and the file msg.py
is given as :
import sys
import os
sys.path.append(os.getcwd())
from greet.greet import greet_morning
greet_morning("heyy")
When I try to run msg.py
as python message/msg.py
, I get an error saying ImportError: No module named greet.greet
. I am running this file from the root. Why do I get this error, when I have already added the cwd
in the system path?