Keep in mind that the c++ and in that case the Python API is not thread-safe: you should only access API functions from within the c++ simulation thread, or from your Python simulation thread (if you work with the CoppeliaSim Python Client application, coppeliaSim.py)
Cheers