Skip to content
Related Articles

Related Articles

Improve Article
How to check if an application is open in Python?
  • Last Updated : 24 Feb, 2021

This article is about How to check if an application is open in a system using Python. You can also refer to the article Python – Get list of running processes for further information.

In the below approaches, we will be checking if chrome.exe is open in our system or not.

Using psutil

The psutil is a system monitoring and system utilization module of python. It is useful mainly for system monitoring, profiling and limiting process resources, and management of running processes. Usage of resources like CPU, memory, disks, network, sensors can be monitored. It is supported in Python versions 2.6, 2.7, and 3.4+. You can install psutil module by using the following command

pip install psutil

We will use the psutil.process_iter() method, it returns an iterator yielding a process class instance for all running processes on the local machine.


# import module
import psutil
# check if chrome is open
"chrome.exe" in ( for i in psutil.process_iter())



We import the psutil module. Then we search for chrome.exe in all running processes on the local machine using psutil.process_iter(). If found it will return output as TRUE, else FALSE.

Using WMI (only Windows User) 

The wmi module can be used to gain system information of a Windows machine and can be installed using the below command: 

pip install wmi

Its working is similar to psutil. Here, we check if a particular process name is present in the list of running processes.


# Import module
import wmi
# Initializing the wmi constructor
f = wmi.WMI()
flag = 0
# Iterating through all the running processes
for process in f.Win32_Process():
    if "chrome.exe" == process.Name:
        print("Application is Running")
        flag = 1
if flag == 0:
    print("Application is not Running")


Application is Running

We import the wmi module. Then we search for chrome.exe in all running processes on the local machine by iterating through the process names. If it matches with the process. Name, it will print Application is Running, else Application is not Running.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :