I would like to change the value of a parameter in an imported function without putting it as input. For instance:
# in def_function.py
def test(x):
parameter1 = 50 # default value
return parameter1*x
# in main.py
from def_function import test
print(test(1)) # It should give me 50
parameter1 = 10 # changing the value of parameter1 in test function
print(test(1)) # It should give me 10
parameter1inmain.pyis unrelated toparameter1inside thetestfunction indef_function.py.x.def test(x, parameter1=50). If you call the function without a second parameter it will use the default value of50.def test(x, parameter1=50)and if you need a differentparameter1just usetest(1, 10).