How do I execute entire python file from another python file!?

I have created a python file which normally execute the function of another file and when I try to execute the entire file, program is executing but nothing is happen. The outside code of the function is not executing. So how do I execute both outside code of the function and the main function. If anyone reading this please reply ASAP!

This needs further details. How are you executing the other file in your code? What do you expect the program to do when it’s working (such as, should it be producing particular output)?

I would advice you to verify that it’s actually not running using print statements.
A file is always run fully when it is imported. This is why if __name__=="__main__" blocks are used.
If you can import it but nothing is working, inspect the imported object. You may be importing the wrong thing.

My Apologies, I’ve got misdeed. I made unusual imports in the program, so it took a long time to execute the program

I removed it once, then it’s running normally.

From this, one more question arises in my mind that if I import unusual imports in the program, why does the program take some time to execute, even though it does nothing

It compiles the source code to bytecode the first time it’s imported. The bytecode is cached, so importing is faster for later runs.

I’ve got you :+1:.