django - How do I share a python script's imports with another script? -


Assume that I have script1.py with import.

How can I import script 1.py with Script2.py? Without copying and pasting

Your application contains several modules that are logical independently, making it easy to read your program , Debug, etc. As the standard library of Python is divided into several modules (as you said - you have to import many things from them).

The more modules you have, each of them needs less import. This is because every separate part of your program requires import only. From this perspective you and other programmers can easily understand the code.

Another way to deal with it (not really recommended):

importports.py: (In this example I think you can test.py in that same directory) > Import Import from Import Import

Do # import your import today = date.today () # Do you import into importports.py print (today)

This could be a dangerous reason possibly one Name Imported Be Careful!

Comments