[Tutor] confusion about imports

Joel Goldstick joel.goldstick at gmail.com
Mon Jul 9 18:13:41 CEST 2012


On Mon, Jul 9, 2012 at 11:56 AM, Chris Hare <chare at labr.net> wrote:
>
> So, I have to admit, imports have me really confused.  I am trying to break apart a 10,000+ line single file into various files, one for each class, and one containing a whole bunch of functions which are used by a lot of classes.  Some of those functions use calls to methods in a Class.  Even though the Class has been imported, I get a nameError where trying to use the class.  I have read about Classes and packages and modules, but import just has me confused.


a 10k line file is a scary thought!  Can you make a very small example
that shows your problem.  Something like

import whatever

my_thing = whatever.classname()


and tell us if you get the error?

This is a wild guess, but from reading your question I'm wondering if
you are instantiating the class?
-- 
Joel Goldstick


More information about the Tutor mailing list