就不翻译啦 很浅的英语
The following is structure of my program
./abc.py
./a/__init__.py
./b/__init__.py
./b/t.py
Source code of abc.py
=============
import a
=============
Source code of ./a/__init__.py
=======================
from b import t
=======================
Source of of ./b/t.py
=================
def aa():
print "bbb"
=================
./b/__init__.py is an empty file.
There is a statement
========
t.aa()
========
if I put it into ./a/__init__.py, then when I run abc.py, it works fine. But if I put it into abc.py, when I run the script, I get an error like
Traceback (most recent call last): File "abc.py", line 3, in t.aa() NameError: name 't' is not defined
What's the reason of this? Thank you in advance.
The following is structure of my program
./abc.py
./a/__init__.py
./b/__init__.py
./b/t.py
Source code of abc.py
=============
import a
=============
Source code of ./a/__init__.py
=======================
from b import t
=======================
Source of of ./b/t.py
=================
def aa():
print "bbb"
=================
./b/__init__.py is an empty file.
There is a statement
========
t.aa()
========
if I put it into ./a/__init__.py, then when I run abc.py, it works fine. But if I put it into abc.py, when I run the script, I get an error like
Traceback (most recent call last): File "abc.py", line 3, in t.aa() NameError: name 't' is not defined
What's the reason of this? Thank you in advance.