zjm_code
|-----a.py
|-----a
|----- __init__.py
|-----b.py
in a.py is :
c='ccc'
in b.py is :
import a
print dir(a)
when i execute b.py ,it show (it import 'a' folder):
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
and when i delete a folder, it show ,(it import a.py):
['__builtins__', '__doc__', '__file__', '__name__', 'c']
so my question is :
how to import a.py via not delete a folder
thanks
updated
i use imp.load_source, so in b.py is :
import imp,os
path = os.path.join(os.path.dirname(__file__), os.path.join('aaa.py'))
ok=imp.load_source('*',path)
print ok.c
it is ok now ,and print 'ccc'
and
how to show 'ccc' via "print c" not via "print ok.c" ???
thanks
updated2
it is ok now :
imp.load_source('anyname',path)
from anyname import *
print c
it show 'ccc'
updated3
it is also ok:
import imp,os
imp.load_source('anyname','aaa.py')
from anyname import *
print c