Run python module from console

Thomas Jollans tjol at tjol.eu
Wed Sep 6 13:11:53 EDT 2017


On 05/09/17 17:14, Andrej Viktorovich wrote:
> Hello,
>
> I suppose I can run python module by passing module as param for executable:
>
> python.exe myscr.py
>
> But how to run script when I'm inside of console and have python prompt:
>

The runpy module can help you do this.
https://docs.python.org/3/library/runpy.html

However, as others have hinted, if you want to run bits of Python from
Python, then it's probably better to use functions.


-- Thomas





More information about the Python-list mailing list