Getting "ModuleNotFoundError" while creating my own packages and trying to import them

Thank you for your python training videos which really helped me to learn python. currently I am encountering an issue with “Packages and Modules” and couldn’t identify the solution.

Problem: I have created 2 Packages (Pack3 and Pack4 where I created 2 python files in Pack3 for Math Calculations and String functions). I have created another python file in Pack4 and trying to import the the 2 python files from Pack3.

pack3 → test1.py

pack3-> test2.py

pack4->strAndNum.py (this is the file where i am trying to import the python files from pack3 package

from pack3.test1 import addition, mathsProblems
from pack3.test2 import strWorks

Compilations time I didn’t see any error. But while executing the program, I see the below error

File “c:\Users\Hiptify Solutions\Desktop\Automation\Python\Examples\pack4\strAndNum.py”, line 1, in
from pack3.test1 import addition, mathsProblems
ModuleNotFoundError: No module named ‘pack3.test1’

Can you please look into this issue and give me any hints on resolving the issue.

Thank you very much for all your help and trainings

I am not too familiar with PY, but do you need to have an absolute path to the import files?

For example, the import files are not in the folder where they are importing from, so do you need to use something like, from '..\pack3.test1' import addition

Hi.. Thanks for the reply.. I tried with relative path too but same error observed.