Python How to supress showing Error in user created function before the function is called
Question: I have imported a user created file into my main code but an error in imported
file is being displayed before. How can I suppress that error and display it
only when the function is called

Importing file and its function :

    
    
    import userValidation
    
    NameString = input("Enter your name : ")
    

I have called `user_validation` function later in the code :

user_validation(names)

`user_validation()` has some error which I know and is being displayed just
after the code start running.

I want to suppress the error till the time user_validation is called.How can i
do that.


Answer: Use exception handling appropriately.

    
    
    try:
    
    #code with exception
    
    except:
    
    #handle it here
    

In the `except` part you may use `pass` to just move on if no action is
required or use `raise` to handle it in the calling function.

