I have a Python script that has url, token, location, and version as environment variables. I trigger it using the classic Python task. I declared these variables inside the pipeline variables section, and inside the code, I did the following:
import os
os.environ['url']
os.environ['token']
but I get keyerror: 'url'
I came across this link, which creates a variable group and passes the environment variables as arguments. But this step follows inline script based execution.
The variables url and token are marked as secret for the purpose of sharing them here.


To access pipeline variables from Release pipeline into classic task, we can import them by passing them as arguments.
In .py script
in arguments we pass the following
$(URL)and$(TOKEN)without spaces.