Yes, just create a separate module and import it into yours.
Example:
'''Here go all of my imports'''
import sys
import functools
from contextlib import contextmanager
....
'''One of my project files.'''
from my_imports import *
....
'''Another project file.'''
from my_imports import *
....
Please note that in accordance with standard recommendations should be avoided . If you are managing a small project with several files that need a common import, I think that everything will be alright with you , but it will still be a better idea to reorganize your code so that different files need different imports. from module import *from module import *
So do this:
'''One of my project files. Takes care of main cycle.'''
import sys
....
'''Another project file. Main program logic.'''
import functools
from contextlib import contextmanager
....
source
share