Newbie import probelm..

yab matthew.warren at powergen.co.uk
Tue Feb 3 13:15:41 CET 2004


Hallo,

Why does this work when I type it in a t the interpreter prompt;

>>>class invoker:
	def ex(self,cmd):
		print 'would do ', cmd

>>>x=invoker()
x.ex('test')
would do  test

but if I save invoker as invoker.py in a dir that is in sys.path and import it the follwoing happens;

>>> import invoker
>>> x=invoker()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: 'module' object is not callable
>>>




More information about the Python-list mailing list