Python - Import From A File When A Package Has The Same Name
I did something silly when I started my python project: I named my main file project.py, and I stored a bunch of logic in a package that is also called project. Here's the director
Right now, my solution is to move the logic from project.py to a new file:
project.py
project/
main.py
contents of project.py:
import project.main
if__name__== "__main__":
project.main.main()
Then I can import project.main.main() directly.
Post a Comment for "Python - Import From A File When A Package Has The Same Name"