John P
John P

Reputation: 1221

Python beginner unable to import a module

I am very new to python, and I try to import a module, and I am unable to.

NOTE I am also using some external dependencies, which I will not include them in the question. I have no problem with imports inside the hl7_utils.py

The python verison is 3.7

here is my project structure:

-src:
    final_client.py
    hl7_utils.py
    __init__.py

Here is the hl7_utils content:

from hl7apy.core import Message

from sepsis_1.sepsis_one import SepsisOne


def create_sepsis_message(key, value):
    print('removed contents for brevity')


def generate_hl7_analysis_for_patient():
    print('removed contents for brevity')

And here is my final_client.py:

from hl7_utils import generate_hl7_analysis_for_patient

generate_hl7_analysis_for_patient()

The __init__.py is empty

Why do I get the ModuleNotFoundError: No module named 'hl7_utils' ?

Upvotes: 0

Views: 173

Answers (1)

coaxium
coaxium

Reputation: 113

you have an error

ModuleNotFoundError: No module named 'hl7apy'

if you run python3 final_client.py

remove these:

from hl7apy.core import Message

from sepsis_1.sepsis_one import SepsisOne

and you be able to run without error:

$ python3 final_client.py 
removed contents for brevity

Upvotes: 4

Related Questions