A
A
AlexEfim2020-02-21 03:29:52
Python
AlexEfim, 2020-02-21 03:29:52

How to correctly access an instance from third-party modules?

Good afternoon, the question may be stupid, but google does not work.

For example: if I create an instance of the class described in the bot.py module from the main page of the application (main.py) - at startup, how can I access the created instance from a third-party module?

As far as I understand, each call to a class from bot.py leads to the creation of a new "clean" instance, but you need to work with the fields of the one that was created from main.py.

Or is a variable assigned to an instance of the "through" class for all imported application modules and can be accessed from anywhere while the application is running?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-02-21
@sergey-gornostaev

5e1ff0ac066b9696317852.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question