Share headers among files in python?

Is there a way to share headers in python? I am importing the same things in different controllers in pylons.

+2


a source to share


2 answers


Try putting the generic code into a file __init__.py

. As in here : "The file is __init__.py

usually empty, but can be used to export selected portions of the package under more convenient names, hold convenience functions, etc."



+3


a source


You can put the "header" in your own module and then, wherever you need it, do



from myheadermodule import * 

      

+1


a source







All Articles