Python Forum
i must be missing something obvious
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i must be missing something obvious
#1
i ran into a problem with some big code and minimized it and the problem remained.  but should this be obvious?  did i miss something that should be obvious or is there a glitch in my brain?  what do i need to change to make this work?
Output:
lt1/forums /home/forums 2> wc -l {bill,cash}.py 2 bill.py 3 cash.py 5 total lt1/forums /home/forums 3> head {bill,cash}.py ==> bill.py <== import cash pay() ==> cash.py <== def pay():    print('hey')     return lt1/forums /home/forums 4> python3 bill.py Traceback (most recent call last):   File "bill.py", line 2, in <module>    pay() NameError: name 'pay' is not defined lt1/forums /home/forums 5>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
um... you import cash but call pay rather than cash.pay
Reply
#3
import cash

cash.pay()
Or:
from cash import pay

pay()
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020