Can't access Bluetooth serial with Python ESP32

Hello,

I found a kind of a solution for it. Not including ser.open() lets it access the bluetooth serial and it prints the data. However, once the program is terminated, I must shut down and restart the ESP32 again to re-access the bluetooth serial. Otherwise it shows the error of 'Resource busy'.

The 'new' code to access the bluetooth serial:

import serial

ser = serial.Serial('/dev/cu.ESP32test-ESP32SPP',115200)

while True:
	data = ser.readline()
	print(data.decode())

May anybody help me with this how I could just disconnect and reconnect the bluetooth, without having to shut down and restart the ESP32?