Vadim Khaskel wrote: > > Hi All, > > > > I just started with IronPython in Visual Studio 2005 and I’m having > problem to understand some > > basic things. > > > > I encountered with the following problem: simple app - user presses > Button1 on Form1 and > > Form2 pops up. > > > > I have Button1 on Form1, Form2 in the same namespace with Form1. > > > > def _button1_Click(self, sender, e): > > f2=Form2() > > > > Error I get is this: > > > > name 'Form2' not defined > > > > Since Form2 in the same namespace I assume that there is no need to > import anything to Form1.py, but > > I’m getting the same error regardless if I’m importing Form2.py or not. >
I'm afraid that this error means that you *don't* have the name 'Form2' in your namespace when this code is called. You need to include something like: from form2_module import Form2 Python will only let you use names that you have either defined or imported into the current namespace. Just importing the *module* that contains a definition doesn't give you access to all the names defined in the module (Python differs from the C# 'using' directive in this respect). Michael http://www.manning.com/foord > > > Thanks for help, > > > > Vadim > > > > > > ------------------------------------------------------------------------ > Your smile counts. The more smiles you share, the more we donate. Join > in! <www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline> > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com