.moduleB
is a relative import. Relative only works when the parent module is imported or loaded first. That means you need to have proj
imported somewhere in your current runtime environment. When you are are using command python3 moduleA.py3
, it is getting no chance to import parent module. You can:
from proj.moduleB import moduleB
OR- You can create another script, let’s say
run.py
, to invokefrom proj import moduleA
Good luck with your journey to the awesome land of Python.