In order to keep my code clean and organized, I split my classes up into a bunch of different files and folders, here is what a typical project structure will look like for me:
> Project
__init__.py
main.py
ui.py
> lib
foo.py
bar.py
In my ui.py file, I usually define some sort of info function if the application is just a command line application. That usually looks something like this:
def info(message, level=1):
if level == 1:
token = "[+] "
elif level == 2:
token = "\t[-] "
print token + str(message)
Now the question is, if I am doing a lot of the work in main.py, and have therefore created a ui object in it by importing it in, what is the best way then to use the same info function in foo.py or bar.py?