Modules Quizz 4
—-

#!python
# fichier module1.py
prompt = '%'
def printer(x):
print(prompt,x)
#!python
# fichier module2.py
from module1 import prompt
def printer(x):
print(prompt,x)
>>> import module1 as m1
>>> import module2 as m2
#!html
<br clear=right>
—-

>>> m1.prompt = '*'
>>> m2.printer('Hello')
% Hello
#!html
<br clear=right>
—-

>>> reload(m2)
>>> m2.printer('Hello')
- Hello
#!html
<br clear=right>
—-

>>> reload(m1)
>>> m2.printer('Hello')
- Hello
#!html
<br clear=right>
—-

>>> reload(m2)
>>> m2.printer('Hello')
% Hello
#!html
<br clear=right>
—-