pythonpython-3.xwindowspycharmproject

If the name of the main file in my project is changed from main.py to something else, will it make any difference?


If I change the name of the main python file in my project directory from main.py, will it make any difference? For example, if a project of mine has an image and two scripts main.py and side.py, and if I rename main.py to myfile.py, will it impact my project in any way? If so, how? I don't think this is a duplicate since I researched a lot before asking. Sorry if I sound like an idiot, I am a beginner.


Solution

  • If you are referring to any function (e.g. function1, function2) in myfile.py from side.py, pl change your import in side.py to from myfile import function1,function2.