I have two py files. a.py and b.py inside a package called test (has __init__.py
)
and I want to access attribute self.items defined in the a.py below
import b
class Window(object):
def __init__(self):
self.items={'Magenta':'mag','Grey':'gre','Red':'red'}
def getMats():
newobj=b.BAR()
selected = newobj.type_of_mats[1]
from a different py file b.py[below] so in b.py I imported the a module i.e.
import a
#now
obj = a.Window()
print obj.items['Magenta']
class BAR(object):
def myMat(self):
type_of_mats=['ground', 'corridor', 'Outdoor']
should'nt the above prints mag since or how else I should do it ?