'Python debugger for bazel targets in Pycharm

I am studying a repository and for that I am running bazel targets that require command line arguments. I want to debug the code in Pycharm, using the Pycharm debugger(I don't want to use pdb). The repository is structured in a way that when I run the code using the Pycharm debugger, I get import errors, and I can only run it as a bazel target from terminal using bazel run <path to file> -- arguments. I want to run it in such a way that I can load all the variables similar to the image - Pycharm console image



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source