Good practice with python conditional import

时间:2017-12-18 07:51:20

标签: python

I have a common utils named submodules, which is shared across different target (dataset, for example). So, I have to define some target specific attributes, like function and variables.

I have try to do something like this

utils.py

But def setup(name): if ...: var = val import module elif ...: do something is prohibited within function.

Is there any good practice or any elegant way to do this?

0 个答案:

没有答案