[Tutor] running an imported function

Cranky Frankie cranky.frankie at gmail.com
Fri Apr 27 17:57:59 CEST 2012


This is in 3.2.2.

I wanted a function to clear the screen in IDLE. I have this in a
clr.py file in a directory in my path:

# Function to clear the IDLE screen by printing blank lines
def clr():
        '''Function to clear the IDLE screen
           by printing 50 lines.'''
 	for i in range(1, 50):
 		print()


I can import it in IDLE no problem, but when I do this:

>>> clr()

I get

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    clr()
TypeError: 'module' object is not callable



Is there a way I can import clr.py and then run clr()?


-- 
Frank L. "Cranky Frankie" Palmeri
Risible Riding Raconteur & Writer
“The problem with quotes on the Internet is that
it is often difficult to verify their authenticity.”
- Abraham Lincoln


More information about the Tutor mailing list