In a file a.py I have the following code:
# a.py
def test():
global i
print(f'The number is {i}')
So, in a file b.py I imported a.py:
# b.py
from a import *
i = 22
test()
When I run this code I get the following error:
NameError: name 'i' is not defined
I thought this would work, once the function was imported, and, object i was defined in b.py. How do I resolve this?