Python import script on another folder in same level

后端 未结 2 1074
鱼传尺愫
鱼传尺愫 2021-01-27 17:32

Lets say this is my project structure :

codes

 - pre.py

training

 - model.py

Both folder have empty __init__.py inside them, an

2条回答
  •  旧时难觅i
    2021-01-27 18:28

    try using full path of your code folder

    import sys
    sys.path.insert(0, "fullpath")
    from pre import *
    

提交回复
热议问题