3 ms·
Its not broken? Just like with everything, you have to understand semantics. If you are writing anything more than a single file, a.k.a a module that has direc
by ActorNightly 3y ago
Its not broken? Just like with everything, you have to understand semantics.
If you are writing anything more than a single file, a.k.a a module that has directories and subdirectories, which you will import in another place, you are supposed to put everything into a package format and install it with pip install -e ./
Then, within the module are free to use the absolute imports starting with the module name, or relative ones, and it all works like a charm. The import system is designed around this.
Alternatively, you can modify the PYTHONPATH env variable, or modify sys.path dynamically, to append to paths and import directly.
- akasakahakada 3y agoRelative import should be independent of package. One should be moving files around without rewriting all import headers.
- aprdm 3y agoThat's opinion, not a fact