Can't access any submodules in Python unless directly imported

Question:

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.

Asked By: SuperCodeBrah

||

Answers:

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

Answered By: falafelocelot
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.