I believe that the contents of profile.run() isn't running in the same name space as doit(). Suspect you will need some glue code then run('glue(slow_dog()') to pick up self from some other place. --Darrell > >>> class C: > ... def slow_dog( self ): > ... import time > ... time.sleep(5) > ... def doit( self ): > ... import profile > ... profile.run( 'self.slow_dog()' ) > ...