News for hackers. Stuff that matters.
Re:How the Python import system works by not_skynet on Saturday July 24, 2021 @10:21PM (#27946133)
I actually spent time wrestling with exactly this earlier today, and I think I finally have a 2 line solution for it:

https://pastebin.com/5WCXb2Gg

Assuming `foo.bar` is a script inside the package `foo` that you want to both import and run directly (without `python -m ...`), this lets you do so without too much hassle.

There are no comments on this comment yet.