Importing modules from parent folder

前端 未结 22 2679
梦毁少年i
梦毁少年i 2020-11-21 23:19

I am running Python 2.5.

This is my folder tree:

ptdraft/
  nib.py
  simulations/
    life/
      life.py

(I also have __init

22条回答
  •  既然无缘
    2020-11-21 23:50

    It seems that the problem is not related to the module being in a parent directory or anything like that.

    You need to add the directory that contains ptdraft to PYTHONPATH

    You said that import nib worked with you, that probably means that you added ptdraft itself (not its parent) to PYTHONPATH.

提交回复
热议问题