I want to monkey patch a new class and then import that class but I get an error ModuleNotFoundError. At the same time I can use the new patched function. I believe that I miss how to add it in the "init" file.
See the following simplified example:
import numpy
class wrong_functions():
def wrong_add(num1, num2):
return num1 + num2 + 1
numpy.random.wrong_functions = wrong_functions
numpy.random.wrong_functions.wrong_add(1,1) # works
from numpy.random.wrong_functions import wrong_add # does not work
from numpy.random.wrong_functions import * # does not work
What do you think? Is that possible?