[FRPythoneers] New person's question

Mike Olson Mike.Olson at fourthought.com
Thu Jul 18 11:52:16 MDT 2002

On Thu, 2002-07-18 at 11:58, David Graham wrote:
> OK:
> I am probably doing something stupid here.  But I can make a class and 
> run it from a script if the class and the script are in the same file. 
>  But when I seporate the class into it's own file, the file compiles ok, 
> but I keep getting the following error.
> Traceback (most recent call last):
>   File "./test_session.py", line 16, in ?
>     session = igor_session()
> TypeError: object is not callable: <module 'igor_session' from 
> './igor_session.pyc'>
> What am i missing when I seporate the two into seporate files?

I'm assuming that the name of the module is igor_session and it contains
a class in it called igor_session.

If so then you probalbe have something like
import igor_session
session = igor_session()

In this case, the variable is a module (what import puts in the global
namespace).  The module has attributes on them, one being your class. 
to access it you would do something like

session = igor_session.igor_session()

The first igor_session is the module, and the second is the class
defined in that module.  FYI, you can take this indefinitly farther, you
can access a method on the class like


and so on and so on assuming that what ever you are accessing has

Does that help?

> Dave
> -- 
> David W. Graham
> Director of Geospatial Applications Development
> information integration and imaging, LLC
> 201 Linden St, Third Floor
> Fort Collins, CO 80524
> (970) 482-4400
> dgraham at i3.com
> http://www.i3.com
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
Mike Olson                                Principal Consultant
mike.olson at fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St,                      http://4Suite.org
Boulder, CO 80301-2537, USA
XML strategy, XML tools, knowledge management

More information about the FRPythoneers mailing list