I start a python project that continues developing. It has 10 local libraries. Each of them call each other "from name import *". For a example from main:
from name3 import *
from name2 import *
from general_functions import *
from messages import *
from network import *
from keyboard_functions import *
from process_functions import *
from name4 import *
from settings import * # settings
According to zen of python, explicit is better than implicit. Also due to understanding and debugging project, i need explicit the importing methods and variables.
Also other libraries use the same import methods. I feel all libraries import all libraries by the "*".
I try to refactoring by the hand
from debug_functions import (print_log, print_log2, debug_functions_initilizer, debug_prints_abbrev, print_setting_info,
print_error, print_warn, print_error_warning_count_of_this_process, print_debug,
print_performance_report)
like this.
But i stopped when i see deep.
For example a.py import exp1 library. In the b.py, it call from a.py import *
. So in the b.py, exp1 library can be used without import exp1. So in the b.py, if i convert from a.py import *
to explicit form, from a.py import something
, there occury errors that depend on exp1 library. There are a lot of example like that.
How do I solve the problem?
UPDATE
What did I? I import libraries with their own methods, variables to each library. For example I have a.py, b.py and c.py libraries. I import a.py and b.py with their own all methods to c.py. Like that,
from a import foo, bar
from b import exp, solv
In b.py, in the same way,
from a import foo, bar
from c import sa, as
After that for now, libraries have necessary methods from real owner, not a 3rd library.
In the end, I delete unused methods in libraries.