How to call PowerShell script from python

Hi Team,
How to call PowerShell script from Python.
I Have installed Python 3.7 and Powershell 7 version
I am running the below python script to call a PowerShell script

import subprocess, sys
p=subprocess.Popen(["c:\program files\powershell\7\pwsh.exe". "c:\scripts\abc.ps1"], stdout=sys.stdout)
p.communicate()

Getting the below error
File “c:\program files\Python37\lib\subprocess.py”, line 775, in_init_ restore_signals, start_new_session)

Thanks
Vel

I cannot tell nothing about Python but when you run

pwsh /?

in a CMD or PowerShell console it will tell you the proper syntax to call PowerShell with a script file. :wink:

BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance
How to format code in PowerShell.org

Please I tried adding users to an organization unit using PowerShell script it worked but the users are not showing on the organization unit. PowerShell scripts. it was created on my member server .What do I do

Oyinkansola,
Welcome to the forum. :wave:t4:

Please do not hijack other members threads - especially when they are actually unrelated to your issue. Instead create a new question for yourself an place a link to the question you think is related in your question.

Thanks in advance.