Python: import module from another directory at the same level in project hierarchy

后端 未结 4 1609
野的像风
野的像风 2020-11-29 17:07

I\'ve seen all sorts of examples and other similar questions, but I can\'t seem to find an example that exactly matches my scenario. I feel like a total goon asking this be

4条回答
  •  囚心锁ツ
    2020-11-29 18:04

    In the "root" __init__.py you can also do a

    import sys
    sys.path.insert(1, '.')
    

    which should make both modules importable.

提交回复
热议问题