Home > Back-end >  Can't access any submodules in Python unless directly imported
Can't access any submodules in Python unless directly imported

Time:07-30

Here's an example:

import scipy
scipy.signal

This gives the error: module 'scipy' has no attribute 'signal'

However, this works:

from scipy import signal

This also works:

import scipy.signal

And then once that is run, scipy.signal then works.

I'm getting this error in Anaconda (Spyder) as well as when running python3 and trying to access submodules in the terminal. I tried with multiple packages.

I'm using an M1 Mac purchased only a few months ago. Any help is appreciated.

CodePudding user response:

This is not an error. This is how the scipy API is designed. You can read about the scipy api here

  • Related