python – Nautilus script – Bash script to extract the current folder

I want to use a Nautilus script that calls a python script from me, passing the path of the current folder as the required argument. This would take care of revising the Python script to extract the folder path from the URI provided by URI $ NAUTILUS_SCRIPT_CURRENT_URI, Ideally, I would like something like that.

#! / bin / bash
$ current_folder = EXTRACT THE FOLDER PATH OF NAUTILUS_SCRIPT_CURRENT_URI
python3 /path/to/my/file.py $ current_folder -optarg 1

From where $ current_folder is a required argument for my python script, and option 1 indicates that my script also accepts optional arguments.

How do I extract the current folder with the bash script?