Assigning variables in exec not working

When I try to use eval to assign a variable, It does not work.
here is my code: eval(f"{self.commands.get(command)[1]} = \"{a[1]}\")
but it gives this error: File “C:\Users/user/AppData/Local/Programs/Python/Python310\customShell.py”, line 15, in run
eval(f"{self.commands.get(command)[1]} = “{a[1]}”\n{self.commands.get(command)[2]}")
File “<string>”, line 1
say = “moo”
Is there any way to fix this?

eval() takes an expression. Its purpose is to “evaluate” something that yields a “value”. An assignment does not give you a value. eval() would not know what to return from a = 5. Instead, use exec(). The difference is that exec() takes a statement – it does not return any useful value (which in Python means that it returns the special None value), but it executes the code, which can have side effects on the environment, like the side effect of assigning a variable.

>>> eval("5")
5
>>> eval("a = 5")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
    a = 5
      ^
SyntaxError: invalid syntax
>>> exec("5")
>>> exec("a = 5")
>>> a
5

Oh ok I must have confused it with the JS eval