[Python-ideas] Relative Imports

Nathaniel Smith njs at pobox.com
Tue Nov 13 20:21:44 EST 2018


On Fri, Nov 9, 2018 at 4:32 PM, danish bluecheese
<danish.bluecheese at gmail.com> wrote:
> you are right on the lines you mentioned. Those are all working if i run it
> as a module which i do every time.
> This is somewhat unpleasant to me, especially while developing something and
> trying to test it quickly.
> I just want to be able to use same relative imports and run single file with
> `python3 test_main.py` for example.
> Running files as modules every time is tiring. This is my problem.

Have you tried 'python3 -m test_main'? IIRC it should be effectively
the same as 'python3 test_main.py' but with working relative imports.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-ideas mailing list