I have a function and a decorator function,
def decorator(func):
def wrapper(*args, **kwargs):
res = func(*args, **kwargs)
print(func.x)
return res
return wrapper
@decorator
def add(a, b):
x = "hello"
c = a + b
return c
but this would not print the variable x, how do I get the variable x in the decorator?