简体   繁体   中英

importing modules' files into submodules

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 referencing 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM