0

I use webbrowser only in one part of my code, and it seems waste to import it since the beginning of the script, is it a way to import it only at the part of the code I need to use it? Thanks!

1 Answers1

1

Yes. You move the import statement from the top of the script to the point in your script where you want it. For example, you would move the below line from the top of your script to somewhere in the code.

import your_library

Be warned though, if the import is in a function, every time you call that function it will import that library, which may add time to the overall running of the file.

Let me know if you meant a different question.

A. N. Other
  • 392
  • 4
  • 14