I am reading a python code and meet a code like this.
import mod1 as m
# ...
do_something(m.sub_a) #1
However in m, sub_a is missing, but sub_aa exists. How can I make change in the code to rename sub_a into sub_aa without changing the code in #1? Like,
import mod1 as m
import mod1.sub_aa as mod1.sub_a # do something like this
do_something(m.sub_a)
p.s. As sub_a has been used in many files, and mod1 is not suggest to modify, I have to write some wrapper to do this.
import mod1.sub_aa as mod1.sub_ais a syntax error, because you can only have a simple name on the right side ofas, not a name inside a module.You can use assignment to create a new name inside the module instead: