Suppose you have a decorator which accepts an argument as an input decor(N)
.
This decorator is used to decorate a method within a module funcs.py
# funcs.py
@decor(N=10)
def testMethod():
# do something
return something
This funcs.py
module is now imported in main.py
where testMethod
is called.
# main.py
import funcs as funcs
funcs.testMethod()
Question: How can I alter N
from `main.py' ?
My attemp was to set N
as an attribute of funcs.py
, but when I tried to alter this attribute funcs.N = 20
within main.py
, funcs.testMethod
run with N=10
.