+ 1
Why This Programs show Error. if __name__ == '__main__':
def name(name): print(f"This Is {name}") if __name__ == '__main__': name("ahmed") When i import this program to another program this program show error.
1 Answer
+ 4
Syed Ahmed Raza Shah It should work.
I ran your exact code from my end here. It works pretty well.
I also imported it as a module, it gave me the expected result
However, this is what I will advise
1. Make sure you saved this particular code in the same directory of the python script you're trying to import it into
2. Make sure you saved each scripts before you try to executes them
Give me a feedback, let's see how it goes together