Created
October 8, 2019 15:18
-
-
Save eguven/71c3a041990de6abf9289cd3966fa16b to your computer and use it in GitHub Desktop.
Example for changing python module scope
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
m = importlib.import_module('mypackage.mymodule') | |
def foo(): | |
return 42 | |
m.foo = foo | |
# | |
from mypackage.mymodule import foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment