I'm asking this question again, because I need an answer quickly and I'm not sure my comment in the original thread will be seen.
"I would like to modify the value of a variable that I declared in my project (Settings > Variables) in a Python recipe. Is it possible ?"
The DSS public API allows you to do that, including via its python client: see DSSProject.set_variable. You'll need to install the python package in the DSS Python environment though.
Depending on the use case, you may find it simpler to use a Set project settings step in a Scenario, even if you have a custom python step before to compute the value.