'Override imported module
Let's say I have:
# a.py
def number(value):
return value+1
# main.py
import a
print(a.number(0)) # 1
Then I change the value of my function, and save the file:
# a.py
def number(value):
return value+2
And then I import it again but I still get the same number:
# main.py
import a
print(number(0)) # 1
What do I need to do to override the function?
Solution 1:[1]
Check if you have .pyc files , remove them if yes and run your code
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sami Fakhfakh |
