Skip to content
Advertisement

I cannot understand the module of the python

Thankyou for helping me in advance.

What I am curious is this.

I made the File A, and in there exist module named B, and there is function C.

Then to use the C, I should type

from A import B

B.C() Something like this.

but when I use the module numpy, there is file named numpy, and there are many files and module in the numpy.

And if I just type

Import numpy

then I can use numpy.array and everything even though I didnt import any module.

I also want If I just import the file A, then I can use the function C.

How is it possible? Sorry for my poor English..

Advertisement

Answer

You should import it initially as:

from A import B.C

That should help

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement