if I create a module called "modtest.py" like this:
 
import turtle
 
def square():
    for i in range(4):
        turtle.fd(100)
        turtle.lt(90)
 
def tri():
    for i in range(3):
        turtle.fd(100)
        turtle.lt(120)
 
 
if __name__ == "__main__":
    
    tri()
 
And then call it like this:
 
import sys
sys.path.append("D:\python\modules")
import  modtest
 
modtest.square()
modtest.tri()
 
why would I just get ability to call the 'square()' function and not the 
'tri()' function.
 
I get a square and a trace back:
 
line 7, in <module>
    modtest.tri()
AttributeError: 'module' object has no attribute 'tri'
 
 
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to