0

I tried to import calculation in Python but I got the following error:

ImportError
cannot import name 'math' from partially initialized module 'calculation' (most likely due to a circular import) (/opt/homebrew/Caskroom/miniforge/base/envs/env_koki/lib/python3.10/site-packages/calculation/init.py)

Please, does anyone have any idea?

I need this module for the script:

result = calculation.calculate(x1, x2, op)

Thanks!

CreepyRaccoon
  • 826
  • 1
  • 9
  • 19
Koki__
  • 1
  • 1
    Your modules have a circular import. (module A imports module B, and module B imports module A.) You can't do that. – John Gordon Oct 29 '22 at 15:51
  • Please see: [import error](https://stackoverflow.com/questions/64807163/importerror-cannot-import-name-from-partially-initialized-module-m) You either have a circular import, or a module which is named the same with one of your packages In case of circular import, you need to find 2 modules that causing this issue and fix your imports. If you have a bad naming, a simple refactoring will do – drx Oct 29 '22 at 15:52
  • Thank you for your answers. However, I'm struggling to understand how I should change the imports. Because this module is built-in, which one should I rename it? – Koki__ Oct 30 '22 at 10:21

0 Answers0