How to import a Python module from a sibling folder?

后端 未结 1 1329
我寻月下人不归
我寻月下人不归 2020-11-27 06:38

I have gone through many Python relative import questions but I can\'t understand the issue/get it to work.

My directory structure is:

Driver.py

A/
         


        
相关标签:
1条回答
  • 2020-11-27 07:14

    This is happening because A and B are independent, unrelated, packages as far as Python is concerned.

    Create a __init__.py in the same directory as Driver.py and everything should work as expected.

    0 讨论(0)
提交回复
热议问题