I think this is almost certainly a very basic question but I’m struggling with it. I have 2 python files, one for the main content on my site and one for the admin area. You can see the two files here:
https://gist.github.com/670034
In both these files I define the classes and import the necessary modules at the top and if I change in one file I need to remember to change in the other file. Is there a way to define all these in one file and then include this for both files?
I’m sure there is an easy way of doing this but I can’t seem to find how to do it.
Thanks
Tom
Just create a file, like
myimports.py:Then you can do:
Note that while this saves space, it doesn’t make it more readable as you need to check the additional file just to see what you imported.