First of all its good to check manually if "appium" command on shell launches the appium server or not(Seems in your case its working fine). In my case it was not with the installation of Appium desktop version. Posting the details of what i did to resolve this in case it helps someone:
- Installed
npm
(as part of node
installation, MSI available at nodejs.org)
npm install -g appium
Now to answer your main question, below is what i used in my Python script to start the appium server on a new window so that it runs separately from the rest of the script execution:
import os
os.system("start /B start cmd.exe @cmd /k appium")
In case you want to change the port(e.g. to 4728) of the appium server (may be when you have multiple servers for multiple devices) you can use following:
os.system("start /B start cmd.exe @cmd /k appium -a 127.0.0.1 -p 4728")
if you want to stop that appium service.
Add these two lines on your code:
os.system("taskkill /F /IM node.exe")
os.system("taskkill /F /IM cmd.exe")