Consider the following code:
#main.py
From toolsmodule import *
database = "foo"
#toolsmodule
database = "mydatabase"
As it seems, this creates one variable in each module with different content. How can I modify the variable inside toolsmodule from main? The following does not work:
toolsmodule.database = "foo"
Sounds like yet another of the multitude of good reasons not to use from toolsmodule import *
.
If you just do import toolsmodule
, then you can do toolsmodule.database = 'foo'
, and everything is wonderful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With