This Python package allows you to copy a function or method and redirect specific references from one instance to another.
from reference_changer import changeReference
def main():
a = 0
b = 1
def f():
print(a)
f2 = changeReference(f, a, b)
f()
f2()
main()Output:
0
1pip install git+https://github.com/d4vidyo/reference_changer.git@latest