I want to update the environmental variable on a bot on Heroku but I get this error. Edit: Looked at the post tagged & it doesn’t answer my question [duplicate]

  discord.py, heroku, python

My enviromental variable is called "GAMES_PLAYED",
I have this piece of code that is supposed to retrieve the environmental variable, add 1 to it, then save the environmental variable and it’s new value.

gamesPlayed = os.environ.get("GAMES_PLAYED")
gamesPlayed = int(gamesPlayed) + 1
os.environ("GAMES_PLAYED") = str(gamesPlayed)

I was sure it would update the variable but instead I get this error:

File "/app/code.py", line 1292
os.environ("GAMES_PLAYED") = str(gamesPlayed)
SyntaxError: cannot assign to function call

Help is appreciated.

Source: Python Questions