Showing results for 
Search instead for 
Did you mean: 
New Member

Execute python script from Power Automate Flow

How does one execute Python script from within a Flow ? 




You can make use of azure functions to achieve the scenario.


You can bind the python script inside azure function and you can use flow to pass input to the azure function.

The flow will call the azure function API and processing will be performed and the result will be returned back to flow.


You can check the below mentioned document regarding the steps on how to create azure function.


You can use HTTP trigger to call the azure function from flow.


If this information helps you, please consider giving a thumbs up and mark the solution as resolved

Is there any other option other than Azure functions ?



If you have a website which allows custom API, then you can built your python program on the website and can use the custom connector to connect to the website and pass information.


You can pass the input parameters from flow and the processing will be done on the website and it will share back the information will which in turn be processed by flow and displayed to the end user.


Hope this approach helps.


If this information helps you, please consider giving a thumbs up and mark the solution as resolved

I achieve this with the onedrive file connector.

Create directories in your onedrive root.


and use a file watcher to monitor file creation in 'root/.run'

than use the onedrive connector to create a new file with contents:

"python > /results/script.txt"


Than create a onedrive trigger as another flow to watch the results folder or whatever you want to do with it.



Hi, I'm very interesting in your method, but I tried to follow, but only get file content with string "python > /results/script.txt", could you please share more details on how you do this? 


many thanks. 

New Member

Use "run powershell script" instead, then type "python %pyFile%" (no quotes) in it.

you mean using Azure Automation? or what connector do you use, do you have an exemple maybe?

No need for that. The python script runs locally, being executed by power shell solely.

1.Create a variable, let us say "x", and store the path to your python script in it.

2.Use the "run power shell script" action, and type "python %x%" inside it.

Thanks a lot for your help, but I can't seem to find an action called "run power shell script" you by any chance know where I did wrong?


Hi VswaldB ,

I think costa86 is using Power Automate Desktop rather than Power Automate cloud fow.

In PAD it's rather easy to excute python script. You can use the way as mentioned by costa86 or if it's just simple script you can also chooose action "Run Python script" by directly input your codes there.


Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,544)