Issue with "__name__" parameter and imports
Hi yall,
I am relatively new to Pycharm/Python and I am struggling with an issue with the "__name__" parameter and imports. My project head is a folder called adversarial-navigation, and my folder structure is adversarial-navigation\GoalDefender\Simulator\__init__.py. My __init__.py file has a "if __name__ == 'main' " statement to allow the file to be run as a script, and this used to work fine. Now, however, I am not sure what changed but when I try and run __init__.py as a script, instead of the __name__ parameter being set to "main", it is now "GoalDefender.Simulator". If I try and change the if statement, I run into other import errors. The same issue occurs with other files in the project. I have attached a screenshot of my run configuration in case this is any help. The interpreter is in "adversarial-navigation\testenviro\Scripts\python.exe". 
Please sign in to leave a comment.
Hi,
When you run the script in PyCharm, the first line of the output contains the run command. Copy it to the terminal outside of IDE and run there - do you get the same result?