從其餘文件夾導入文件 - Importing files from different folder

問題:

I have the following folder structure. 我有如下文件夾結構。 app

application/app/folder/file.py ide

and I want to import some functions from file.py in another Python file which resides in 我想從位於另外一個Python文件中的file.py導入一些功能 this

application/app2/some_folder/some_file.py spa

I've tried 我試過了 .net

from application.app.folder.file import func_name code

and some other various attempts but so far I couldn't manage to import properly. 和其餘一些嘗試,但到目前爲止,我沒法正確導入。 How can I do this? 我怎樣才能作到這一點? get


解決方案:

參考一: https://stackoom.com/question/IOMl/從其餘文件夾導入文件
參考二: https://oldbug.net/q/IOMl/Importing-files-from-different-folder
相關文章
相關標籤/搜索