Mark Bourne 在 2022年8月27日 星期六晚上7:42:37 [UTC+8] 的信中寫道: > import test > test.x = 4 > test.foo() > > -- > Mark. Yes, you are right. But because of I am using "from test import *" which makes the name "test" disappear in the test2 scope, so this is not work.
I solved this problem by moving "x" to a separate config.py file, import it in both test.py and test2.py, and access it using config.x --Jach -- https://mail.python.org/mailman/listinfo/python-list