0

I create a simple python project in Pychram as shown in figure.

It works fine when I run it in Pychram.(run b_code.py, shows 'wow'/n'hellow')

However, when I'm trying to run b_code.py in terminal.

I got [ModuleNotFoundError: No module named 'package_a']

Trying to google this issue but it still confuse me.

How can I fix the issue?

Thank you,

enter image description here

Pychram configuration: enter image description here

Solution: It works by following code

 import sys
 sys.path.append("..")
 from package_a import a_code
 print('wow')
 a_code.say_hellow()
user2334508
  • 303
  • 1
  • 3
  • 11
  • 1
    Show us the PyCharm configuration. Note that where you run the code and how the PYTHONPATH is set up is important. – tyteen4a03 Nov 06 '18 at 20:29

1 Answers1

0

Basically, bcode is unable to find the package. Put an init.py file in the root of the folder where package_a and package_b are located and bcode will know to look for the module there. As you've done inside each package.