[Tutor] running an imported function

Steven D'Aprano steve at pearwood.info
Fri Apr 27 18:17:18 CEST 2012

Cranky Frankie wrote:

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

The same way you import any other module and then call a function in that 
module. Don't be fooled by the function having the same name as the module.

import clr  # import the module
clr.clr()  # and call the fully-qualified name of the function

Or if you prefer:

from clr import clr  # import only the function

By the way, this may be a simpler way of clearing the screen:

def clr():

This is probably better, although it's not guaranteed to work for all terminal 

def clr():


More information about the Tutor mailing list