Please help def issue // NameError: name ' passwordchecker' is not defined : **Indented so much so I could put the code in here**

I am making a password checker and a generator with a menu, the password checker by it's self works fine but the menu does not work along with the code and I've tried the menu by it's self and that does not work either. These are the errors that I am receiving:

Traceback (most recent call last):
  File "C:/Users/Jasiu Czajka/PycharmProjects/untitled/First Code.py", line 41, in <module>
    mainmenu()

  File "C:/Users/Jasiu Czajka/PycharmProjects/untitled/First Code.py", line 24, in mainmenu
    passwordchecker()
NameError: name 'passwordchecker' is not defined


I'm not sure what I've done wrong, so please help if you can.

I use pycharm and python 3.6.3
 












                import re


                def mainmenu():
                    print("*******************************************************************")
                    print("           Welcome to the Password Checker & Generator             ")
                    print('*******************************************************************')
                    print("-------------------------------------------------------------------")
                    print("This program can be used to check a password to see if it is strong")
                    print("-------------------------------------------------------------------")
                    print("This Program can be used to generate strong passwords")
                    print("-------------------------------------------------------------------")
                    print("1. Password Checker")
                    print("-------------------------------------------------------------------")
                    print("2. Password Generator")
                    print("-------------------------------------------------------------------")
                    print("3. Exit")
                    print("-------------------------------------------------------------------")
                    print("*******************************************************************")
                    while True:
                        try:
                            selection = int(input("Enter choice:  "))      # Making selection a variable
                            if selection == 1:
                                passwordchecker()
                                break
                            elif selection == 2:
                                passwordgenerator()
                                break
                            elif selection == 3:
                                exit()
                                break
                            else:
                                print("Invalid Choice. Enter 1-3")
                                mainmenu()

                        except ValueError:
                            print("Invalid Choice. Enter 1-3")
                    exit()


                mainmenu()


                def passwordchecker():

                    print("***************************************************************")
                    print("                       PASSWORD CHECKER                        ")
                    print("***************************************************************")
                    print("                                                               ")
                    print("---------------------------------------------------------------")
                    print("The password must be at least 8 characters, and a maximum of 24")
                    print("---------------------------------------------------------------")
                    print("The Password must contain at least 1 uppercase letter")
                    print("---------------------------------------------------------------")
                    print("The Password must contain at least 1 lowercase letter")
                    print("---------------------------------------------------------------")
                    print("The password must at least have 1 number in it")
                    print("---------------------------------------------------------------")
                    print('The password must have at least 1 symbol')
                    print("Allowed Symbols: !, $, %, ^, &, *, (, ), _, -, +, =, ")
                    print("---------------------------------------------------------------")

                    incorrectpassword = True

                    while incorrectpassword:
                        password = input("Type in your password: ")
                        if len(password) < 8:
                            print("Your password must be at least 8 characters long")
                        elif len(password) > 24:
                            print("Your password must be maximum 24 characters long")
                        elif not any(i.isdigit() for i in password):
                            print("You need a number in your password")
                        elif not any(i.isupper() for i in password):
                            print("You need a capital letter in your password")
                        elif not any(i.islower() for i in password):
                            print("You need a lowercase letter in your password")
                        elif re.search('[!, $, %, ^, &, *, (, ), _, -, +, =,]', password) is None:
                            print("You need a symbol in your password")
                        else:
                            print("Your password has all the characters needed")
                            incorrectpassword = False


                passwordchecker()
                mainmenu()


                def passwordgenerator():

                    print("Work In Progress")
