Visual Studio Code for Pan Tilt Hat

I have written a few lines in Python to control the pan tilt hat. Using the Thonny Python IDE everything works fine. Using Visual Studio Code, it works every second time when running in Debug Mode, but when running in Non-Debug-Mode, nothing happens.