code doesn't work in PyCharm, but work in remote executing

15 Views Asked by At

let us see the code firstly:

.py files are organized as follows:

A
 - __init__.py
 - B.py
 - C.py

# where A is a python package, C is .py file and there is a D class in C.py file.

The B.py file uses D class in C.py file in this way:

import A.C

A.C.D()

My question comes:

If I open the code in local PyCharm software, there is a clear error saying "No module named 'A' ", and I have to correct the code to from . import C and C.D().

HOWEVER,

If I directly executed the code without any correction in the remote environment, It works very well. There is no error about the module A.

Why this happens?

why import A.C does not work in PyCharm, but in the remote environment, it works well?

0

There are 0 best solutions below