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
  not able to call the variable inside the if/elif function mareeswaran 3 615 Feb-09-2025, 04:27 PM
Last Post: mareeswaran
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 5,731 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 1,950 May-02-2023, 08:40 AM
Last Post: Gribouillis
  Function global not readable by 'main' fmr300 1 2,142 Jan-16-2022, 01:18 AM
Last Post: deanhystad
  how to call an object in another function in Maya bstout 0 2,686 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 4,984 Dec-19-2020, 07:30 AM
Last Post: ndc85430
  Struggling for the past hour to define function and call it back godlyredwall 2 3,098 Oct-29-2020, 02:45 PM
Last Post: deanhystad
  list call problem in generator function using iteration and recursive calls postta 1 2,528 Oct-24-2020, 09:33 PM
Last Post: bowlofred
  function call at defined system time? Holon 5 4,368 Oct-06-2020, 03:58 PM
Last Post: snippsat
  how to run another function from main file Mekala 3 4,827 Aug-09-2020, 04:41 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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