The problem of files referencing each other in python package

created a new package with a.pypypy.py in it.
a.py needs to refer to the contents of b.py, but it cannot be introduced in the way of import.
what is the reason for this? How to solve it?

Mar.09,2021

try: right-click the folder, Make Directory As--> Sources Root


in PyCharm why not?
Don't you just import b
directly?


Why can't two py files under the same package be import? directly? Looking forward to new answers.


encountered this problem only when other programs call this package, import rule-- changed to--> import ExtractRules.rule

Menu