Communication Program Python dan Arduino

I have a python programme to send data to an Arduino.

import serial
import time

arduino = serial.Serial(port='COM6', baudrate=9600, timeout=.1)

def send_data(data):
    arduino.write(data.encode())
    time.sleep(0.05)  
    received_data = arduino.readline()
    return received_data

data_to_send = 'Hello Arduino'
response = send_data(data_to_send)
print(response)

in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM6': PermissionError(13, 'Access is denied.', None, 5)

I've tried using COM, but access is denied continuously. Is there a solution to my problem?

Only one application can have the serial port open at a time; your python script will fail on that if e.g. the serial monitor is open.