I have this repository structure:
py_files_and_packages/ # normal folder
package/
module1.py # contains a class
module2.py
the __init__.py
file of this package contains only __author__='my name'
The Problem:
I am trying to import the class from module1.py into model2.py. When I use
from package.model1 import model1
and rung the script(model2.py) within PyCharm it works. However, when I run it from the command line it doesn't find the package. The error message: ImportError: No module named 'my package's name'
.
I tried many tricks I found on the web such as (https://stackoverflow.com/a/22777011/2804070)but it didn't work.
I am using python-3.5.1 (installed locally), PyCharm 5.0.4 community edition, OS debian wheezy
from .module1 import Module1Class1
– user3159253 May 9 '16 at 14:16