I have a module that has the usual
if __name__ == \'__main__\': do stuff...
idiom.
I\'d like to import that from another module
As pointed out in the other answers, this is a bad idea, and you should solve the issue some other way.
Regardless, the way Python does it is like this:
import runpy result = runpy._run_module_as_main("your.module.name"))