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

Run python module from console

On Tuesday, September 5, 2017 at 8:45:00 PM UTC+5:30, 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:
> >>>

By and large not straightforwardly possible
At python prompt you call *functions*
At OS prompt you call apps/programs/scripts including python *scripts*
They are different with different calling conventions

However if you look up on the __name__ == '__main__' trick
you can find ways of getting both function call and script call behavior