Import Local module over global python

后端 未结 2 1564
生来不讨喜
生来不讨喜 2021-01-12 21:36

I have a 2 python files. One is trying to import the second. My problem is that the second is named math.py. I can not rename it. When I attempt to call a function that is l

2条回答
  •  鱼传尺愫
    2021-01-12 22:18

    You could use relative imports:

    from . import math
    

    http://docs.python.org/tutorial/modules.html#intra-package-references

提交回复
热议问题