开发者

importing modules' files into submodules

开发者 https://www.devze.com 2023-01-16 18:32 出处:网络
i have a module with many files, which i import in themselves for sharing of functionality myModule/ -myFile1.py

i have a module with many files, which i import in themselves for sharing of functionality

myModule/
-myFile1.py
-myFile2.py
-mySubmodule/
--myFile3.py

i can do import myFile2, inside of myFile1, but how can i do a import myFile2 in myFile3 without refer开发者_C百科encing the base module? i dont want to reference myModule, because i am working on a branch so the name is going to change.


You're asking about relative imports. See this question

Within myFile3, you want:

from .. import myFile2
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号