I haven't been able to find any direct answers online. Would it just use the one closest to the file that's trying to import it? Is there some kind of priority system? Or would it just return an error?
Asked
Active
Viewed 331 times
-2
-
As a debugging idea, create two of your own modules with the same name. Have each module print its path when imported. Then put them in local folder, python path, etc and see what gets imported first! – SNygard Jun 10 '21 at 13:24
-
1Also, a related question is here: https://stackoverflow.com/questions/9586630/python-paths-and-import-order – SNygard Jun 10 '21 at 13:25
-
2Does this answer your question? [Python import precedence: packages or modules?](https://stackoverflow.com/questions/4092395/python-import-precedence-packages-or-modules) – aaronn Jun 10 '21 at 13:29
-
1@SNygard I tried that, and it worked! Apparently it uses the module closest to the file that's trying to import. – Redcoolhax Jun 10 '21 at 13:36