osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run python module from console


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