Skip to content Skip to sidebar Skip to footer

Does Importing More Slow Down Scripts Python?

Just wondering if importing more functions from other scripts slows down a script in general? Some background: I have two scripts, one that runs much faster than the other, one has

Solution 1:

More information about your case, Import_Statement_Overhead:

Import statements can be executed just about anywhere. It's often useful to place them inside functions to restrict their visibility and/or reduce initial startup time. Although Python's interpreter is optimized to not import the same module multiple times, repeatedly executing an import statement can seriously affect performance in some circumstances.

Post a Comment for "Does Importing More Slow Down Scripts Python?"