I have a folder as follows:
The message.py
file has a class Message
that I would like to import and similarly segments.py
file has a class Segment
that I would like to import.
When I do:
from pydifact.message import Message
from pydifact.segments import Segment
I get the following error:
Traceback (most recent call last):
File "<ipython-input-1-cc598c8ad3ca>", line 1, in <module>
from pydifact.message import Message
ModuleNotFoundError: No module named 'pydifact.message'
But when I add:
import sys
sys.path.insert(0, r"C:\Users\Desktop\automatic-mscons-invoice-generator\edilite\pydifact")
from pydifact.message import Message
from pydifact.segments import Segment
it works fine.
Is there a way I can do the imports directly without having to add the sys.path.insert
?
My working directory is:
C:\Users\Desktop\automatic-mscons-invoice-generator