Debugging a python script in pycharm

The debugger needs a file. So, copying your code snippet into a module is a good approach.

If you work with a code snippet (not saved in file) then you don’t need a debugger, as you can run the code step-by-step anyway.

1 Like