Question: im new in the community !
im trying to run a function with main function and its not working for me.
when im calling to the function it is work pretty good and with the main function calling its not.
pleae help me to solve my problem.

```
def main():
    is_valid_input()

if __name__ == "__main__":
    main()

def is_valid_input():
    """
    this function will check if the the guess is ok
    :param letter_guesses: the user's guess
    :type letter_guesses: str
    :return: True if the guess is complies with the rules and False if not
    :rtype: bool
    """
    letter_guessed = input("please guess a letter").lower()
    import string 
    if letter_guessed.isalpha() and len(letter_guessed) == 1:
        return True
    else:
        return False

```

i added a pic with the problem[![enter image description here](https://i.stack.imgur.com/vyYsl.png)](https://i.stack.imgur.com/vyYsl.png)

Answer: 
In script mode, your `is_valid_input` function is undefined when `main()` will be run. Place this block at the very end of your code (after the definition of `is_valid_input`):

```
if __name__ == "__main__":
    main()

```

Regarding your code *per se*, I am not sure what you want to do exactly, but below is a way to make the `is_valid_input` function only test an existing string:

```
def main():
    letter_guessed = '' # initialize invalid
    while not is_valid_input(letter_guessed):
        letter_guessed = input("please guess a letter: ").lower()

def is_valid_input(letter):
    """
    this function will check if the the guess is ok
    :param letter_guesses: the user's guess
    :type letter_guesses: str
    :return: True if the guess is complies with the rules and False if not
    :rtype: bool
    """
    import string 
    if letter.isalpha() and len(letter) == 1:
        return True
    else:
        return False

if __name__ == "__main__":
    main()

```
The answer provided by [@mozway](https://stackoverflow.com/users/16343464/mozway) is perfect. If you are looking to see the returned value in the terminal then catch the returned boolean value from the function `is_valid_input` and print it.