Debugging with VSCode or Pycharm

The script provided here in answer to a related query works well.