Python Forum
Cannot call main function but I don't know why
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot call main function but I don't know why
#1
I don't know why I get an error with this
It says main is not defined


while True:
    main ()

def main(): 
    MainMenu = input("""Please select a function
    [1] Read Data
    [2] Write data
    [3] Filter data
    [4] Quit database
    """)
Reply
#2
Put main function definition before the while loop.
Reply
#3
(Mar-09-2018, 12:04 PM)j.crater Wrote: Put main function definition before the while loop.

THANNNNK YOUUUUU
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 1,610 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 752 May-02-2023, 08:40 AM
Last Post: Gribouillis
  Function global not readable by 'main' fmr300 1 1,296 Jan-16-2022, 01:18 AM
Last Post: deanhystad
  how to call an object in another function in Maya bstout 0 2,042 Apr-05-2021, 07:12 PM
Last Post: bstout
  In this function y initially has no value, but a call to foo() gives no error. Why? Pedroski55 8 3,417 Dec-19-2020, 07:30 AM
Last Post: ndc85430
  Struggling for the past hour to define function and call it back godlyredwall 2 2,158 Oct-29-2020, 02:45 PM
Last Post: deanhystad
  list call problem in generator function using iteration and recursive calls postta 1 1,862 Oct-24-2020, 09:33 PM
Last Post: bowlofred
  function call at defined system time? Holon 5 3,155 Oct-06-2020, 03:58 PM
Last Post: snippsat
  how to run another function from main file Mekala 3 2,476 Aug-09-2020, 04:41 AM
Last Post: deanhystad
  How to call/read function for all elements in my list in python johnny_sav1992 1 2,039 Jul-27-2020, 04:19 PM
Last Post: buran

Forum Jump:

User Panel Messages

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