I have the main script file, let's call it main.py and I have module file which located in subdirectory "module/", let's call it mod.py (module/mod.py)
The directories tree is like this:
-main.py
-module/
|
|---mod.py
Now I have a global variable in main.py, call it "a" and it's equal to 1. I have a function in mod.py which should print the global variable a.
main.py:
import sys
sys.path.append("module/")
from mod import *
global a
a = 1
print_it()
module/mod.py:
from main import *
def print_it():
global a
print a
When I start the main.py script, I get:
NameError: name 'print_it' is not defined
Why?