On 30/01/14 15:43, Ian D wrote:
if I create a module called "modtest.py" like this:
import turtle
def square():
def tri():
if __name__ == "__main__":
tri()
And then call it like this:
import modtest
modtest.square()
modtest.tri()
why would I just get ability to call the 'square()' function and not the
'tri()' function.
Are you by any chance testing this from inside an IDE and added the
tri() fuinction after the square one?
If so I'd suggest shutting down the IDE and restarting.
You may be seeing the old module imported prior to your
adding tri()
There is a reload()??? function for reloading modules that have
already been loaded to avoid this kind of thing but I don't
trust it entirely so if in doubt shut the IDE down and
restart...
Or just try running it in the command line interpreter
instead...
Assuming my guess at the cause is correct of course.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor