How to launch Multilogin desktop app via script
Use a Python script to launch the Multilogin desktop app on Windows, macOS, or Linux before running other local automation.
➡️ Choose the script for your operating system → update the app path if needed → run the script from your IDE or terminal.
Use this when your automation workflow needs the Multilogin desktop app and its built-in launcher to be running first.
The agent needs a display in order to work. If your system doesn’t have one, use a virtual display. Example (for Linux):
xvfb-run mlx
Before you start
Make sure:
- Multilogin desktop app is installed
- Python is installed
- You know how to run a Python script from your IDE or terminal
- On Linux, a graphical display is available or a supported virtual display is configured
Windows
Run the script via IDE or Command Prompt. Don't know how? Read this article: Getting started with automation scripting.
import os
import subprocess
def connect_agent():
username = os.getlogin()
exe_path = f'C:\\Users\\AntonLa\\AppData\\Local\\Multilogin App\\MLXDesktopApp.exe'
agent_connection = subprocess.run([exe_path])
assert agent_connection.returncode == 0
if agent_connection.returncode == 0:
print("Agent connected")
else:
print(f"Failed to connect agent. Error {agent_connection.returncode}")
if __name__ == "__main__":
connect_agent()
macOS
Run the script via IDE or Terminal. Don't know how? Read this article: Getting started with automation scripting.
import subprocess
def connect_agent():
agent_connection = subprocess.Popen(['open', '/Applications/Multilogin App.app/'])
agent_connection.wait()
return_code = agent_connection.returncode
if return_code == 0:
print("Agent connected")
else:
print(f"Failed to connect agent. Error {return_code}")
connect_agent()
Linux
Run the script via IDE or Terminal. Don't know how? Read this article: Getting started with automation scripting.
import os
import subprocess
def connect_agent():
username = os.getlogin()
exe_path = f'/opt/mlxapp/desktop.bin'
agent_connection = subprocess.run([exe_path])
assert agent_connection.returncode == 0
if agent_connection.returncode == 0:
print("Agent connected")
else:
print(f"Failed to connect agent. Error {agent_connection.returncode}")
if __name__ == "__main__":
connect_agent()