Updating an Imported Function

Donovan Parks donovan.parks at gmail.com
Thu May 7 14:07:33 EDT 2009


Hello,

I'm new to Python and have what is probably a very basic question. I
am writing a helloWorld() function within a file called helloWorld.py:

def helloWorld():
	print 'hi'

Now, I can import and run this function:

import helloWorld
helloWorld.helloWorld()

Which will print 'hi' as expected. Now, I'd like to update this
function in my text editor so it is:

def helloWorld():
	print 'hello world'

Without having to exit my Python interpreter, how can I import this
revised function? If I do the import again:

import helloWorld

And run helloWorld.helloWorld() it will still print out just 'hi'.
I've tried deleting this function (a weird concept to me as I come
from a C++ background) using del helloWorld and than importing again,
but the function will still print out just 'hi'.

Can this be done? How so?

Thanks for any and all help.

Cheers,
Donovan



More information about the Python-list mailing list