Debug python script inside Blender with passing arguments

I'm trying to debug a python script in which passing arguments is required. Since I want to debug, using -b flag is not an option (otherwise there is no problem when running the code in a background mode).

I tried the following thing

filename = "/full/path/to/script.py --Arg1 arg1 ...."


Obviously that didn't work since exec tries to execute a file without additional arguments.

Few notes:

1) If I try to debug w/o passing arguments everything works fine I can debug and do what I want.

2) Some system pros: running docker container with 4 NVIDIA 1080-Ti cards on ubuntu os.

How can this be done?

• @RobertGützkow | These examples demonstrate passing arguments in a background mode Blender. I want to debug my code, hence I need to run it from Blender's GUI. Any suggestions? – AvivSham May 4 '20 at 10:58
• Simply don't use the -b or --background argument? This will start Blender with GUI as usual. – Robert Gützkow May 4 '20 at 11:01
• Then it would be very helpful if you could give a precise description of what you're doing and what your goal is. I don't see why the PyCharm debugger wouldn't work when starting Blender from the command line, as long as the debugger is connected. Is this issue related to your old question? – Robert Gützkow May 4 '20 at 11:46
• With the limited information available, I'd say create two python scripts which are then called from the CLI. The first script connects the debugger by calling the operator that implements this feature (e.g. bpy.ops.debug.connect_debugger_pycharm if you're using the add-on from the old answer). The second script is the one you would like to test and pass arguments to. It has to be the last CLI argument, followed by the arguments you would like to pass into the script. – Robert Gützkow May 4 '20 at 12:12