I
I
Ilkhomjon Matazimov2020-04-28 21:51:24
Python
Ilkhomjon Matazimov, 2020-04-28 21:51:24

Why do I need to additionally import subsections of libraries if the library itself is already imported?

Good day.
Why do you need to additionally import subsections of libraries into Python, if the library itself is already fully imported?

Example:

import telebot
from telebot import что-то там


Why is this needed if the telebot is already imported?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2020-04-28
@mr_qpdb

Only if instead telebot.some_method()of writing simply some_method().
In cases where it is necessary to achieve a minimum consumption of RAM, for example, for deploying to cloud functions, or for running on devices with very limited resources, specific classes, functions, and not the entire module are imported.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question