0 votes
by (140 points)
How do you import a file in Python?

1 Answer

0 votes
by (2.1k points)
The most Pythonic way to import a module from another folder is to place an empty file named __init__.py into that folder and use the relative path with the dot notation. For example, a module in the parent folder would be imported with from .. import module .

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 28, 2019 by fritzing (300 points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 28, 2019 by modules (480 points)
0 votes
1 answer
asked May 17, 2021 by brabmodule (120 points)
0 votes
1 answer
asked Jun 6, 2020 by module (460 points)
...