Как работает функция reload()?
Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора.
Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload()
from importlib import reload
reload(my_module)
🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком!
🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули.
🔸Она не может перезагрузить ранее не импортированный модуль.
🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля.
Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся.
Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты.
Напишем простой модуль
# mymodule.py
x = 1
Теперь импортируем модуль и отдельно переменную х из модуля
>>> import mymodule
>>> from mymodule import x
>>> print(mymodule.x)
1
>>> print(x)
1
Не перезапуская интерпретатор вносим изменения в модуль
# mymodule.py
x = 2
Делаем перезагрузку модуля и проверяем х ещё раз
>>> reload(mymodule)
>>> print(mymodule.x)
2
>>> print(x)
1
То же самое будет если присвоить любой объект переменной (даже словарь или список)
Повторный импорт обновляет значение
>>> from mymodule import x
>>> print(x)
2
🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать.
#tricks#basic
News: #CBE says digital platforms handled over nine trillion birr, accounting for 87% of half-year transactions
The Commercial Bank of Ethiopia (CBE) says transactions conducted through its digital banking platforms surpassed nine trillion birr in the first half of the 2025/26 fiscal year, accounting for nearly 88 percent of the bank’s total transfers and payments.
The figures were disclosed during CBE’s half-year performance review conference, where Wegayehu Gebremariam, Vice President for Strategic Planning and Transformation, presented the bank’s six-month performance report.
According to Wegayehu, digital channels facilitated more than nine trillion birr in transactions during the reporting period, representing 87.9 percent of total banking transactions.
He said CBE accounted for 73 percent of the country’s total digital transactions and payments in the previous fiscal year, adding that current trends indicate the bank is likely to maintain its....
Read more: https://addisstandard.com/?p=54768
News: #CBE launches digital wallet for inward foreign currency transfers
The Commercial Bank of #Ethiopia (CBE), in partnership with local company StarPay Financial Services, has launched a digital wallet application, “CBE Connect,” to facilitate the transfer of foreign currency into the country.
Ephrem Mekuria, Executive Vice President for Corporate Services at the Commercial Bank of Ethiopia, attended the launch ceremony yesterday, alongside ambassadors and senior bank officials.
Ephrem encouraged customers to use legal channels instead of informal foreign exchange markets during his speech at the event. He added that CBE Connect allows users to send money easily using international payment cards such as Visa and Mastercard, as well as through licensed foreign remittance agents.
The bank noted that the digital wallet aims to support international customers, boost foreign currency inflows, and provide the Ethiopian diaspora with a simple, cost-free platform to send and receive remittances.
Ethiopia’s Commercial Bank Announces Digital Banking Disruptions. Read more.
https://borkena.com/2026/05/03/ethiopias-commercial-bank-announces-digital-banking-disruptions/#Ethiopia#bank#CBE#EthiopianNews
#Policy_Brief: Consolidate or Collapse: Mergers and acquisitions as strategic lifeline for #Ethiopian banks
In this policy brief, Samson Hailu contends that Ethiopia’s banking sector is entering a critical phase, as consolidation —particularly through mergers and acquisitions— shifts from a private-sector discussion to a policy priority of the #NBE under Governor Eyob Tekalign.
Although the sector has expanded to 31 banks, the #CBE continues to dominate, leaving smaller institutions vulnerable. Stress tests highlight significant capital and liquidity risks, reinforcing the author’s warning that “consolidation is not merely a strategic choice but a requirement for survival.”
He recommends that smaller “third-generation” banks form partnerships with larger private banks and endorses a “guided voluntary” approach, designed not to mandate consolidation but to facilitate market-led combination.
https://addisstandard.com/?p=56167