Как работает функция 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
#Security vacuum fears grow amid reports of #ENDF withdrawals, alleged redeployment toward #Tigray Region
Withdrawal or reduced presence of federal forces in recent days is raising concerns among local communities. Residents in different parts of the country spoke to Addis Standard on their concern following federal forces evacuating their village while fueling speculation that troops are being redeployed northward amid rising tensions involving Tigray.
Residents in Dirashe district, Gardulla Zone, South Ethiopia Region, and Anfilo districts in Kellem Wollega Zone, Oromia Region, told Addis Standard that Ethiopian National Defense Forces (ENDF) have been vacating certain areas, creating security gaps and fueling local tensions. An AFP report confirmed similar reports of troop movements and heightened military tension near the Tigray border.
https://addisstandard.com/?p=55250
News: #Ethiopia, #Belarus sign military MoU ahead of Air Force’s 90th anniversary
Ethiopia and Belarus have signed a bilateral memorandum of understanding (MoU) aimed at strengthening military cooperation between the two countries, the Ethiopian National Defense Forces (#ENDF) said.
In a statement issued on 22 January 2026, the ENDF said the agreement was signed by Ethiopia’s Minister of Defense, Engineer Aisha Mohammed, and Pantus Dmitry Aleksandrovich, Minister of State Authority for Military Industry of the Republic of Belarus.
According to the statement, Aisha described the MoU as a significant step toward advancing Ethiopia’s military technology and industrial capacity, particularly as the country seeks greater self-sufficiency in defense production.
She also recalled previous agreements reached between the leaders of Ethiopia and Belarus, noting that those understandings provide the foundation for implementing the current strategic cooperation...
Read more: https://addisstandard.com/?p=54710
#ENDF Airborne School graduates combat paratroopers trained for #special_missions
Addis Abeba— The Ethiopian National Defense Force (ENDF) said its Airborne School, under the Special Operations Command Training Center, has today graduated combat paratroopers trained to carry out special missions.
Lieutenant General Shuma Abdeta, Commander of the Special Operations Command, attended the graduation ceremony and pinned “chest wings” on the graduates, according to a statement from ENDF.
Addressing the trainees, Lt. Gen. Shuma said the airborne force “is a cradle of great leaders and heroes,” describing it as a unit that “makes the country proud by concluding formidable and complex missions with victory.”
He added that joining the airborne force requires “exceptional bravery,” noting that a paratrooper must be “a determined hero, invincible to any earthly challenge, and capable of overcoming all obstacles to achieve success.”
https://www.facebook.com/share/1KTQkTwcNF/
News: #Tigray Interim Administration dismisses claims of #ENDF deployment, relocation to Northern Command camps
The Tigray Interim Administration has dismissed as “completely false” reports circulating in recent days alleging that the federal government ordered the #Ethiopian National Defense Forces (ENDF) to enter Tigray and that the regional administration had agreed to the relocation of federal troops to former Northern Command camps.
In a brief statement issued today, the Interim Administration described the claims as “misinformation and disinformation” intended to mislead the public and create unnecessary tension.
“There are rumors in recent days that the federal government has ordered the Ethiopian Defense Forces to enter Tigray, and the Tigray Interim Administration has agreed for the forces to settle in the former camps of #Northern Command,” the statement said.
“The source and the goal of this strategy of spreading such misinformation and....
Read more: https://addisstandard.com/?p=55289
News: Former minister #Gedu says #Eritrean, #Ethiopian forces operated “as a single force” until Pretoria ceasefire, disputes PM Abiy’s account of Asmara’s role in Tigray war
Former Minister of Foreign Affairs Gedu Andargachew has disputed Prime Minister Abiy Ahmed’s recent parliamentary account of Ethiopia’s wartime engagement with Eritrea, saying Eritrean forces fought alongside the Ethiopian National Defense Forces (#ENDF) “effectively as a single force” until the Pretoria ceasefire halted joint operations.
He said he proposed raising the withdrawal of Eritrean forces from Tigray during the visit but was instructed not to do so. According to Gedu, no message concerning the suffering of civilians in Tigray was delivered in Asmara.
In a letter dated 5 February 2026 and sent to Addis Standard, Gedu rejected Abiy’s claim that he served as the Prime Minister’s envoy to Eritrea after the outbreak of the war in Tigray to convey concerns over crimes ....
Read more: https://addisstandard.com/?p=55048
News: #US Assistant Secretary Christopher Landau, AFRICOM commander arrive in #Ethiopia, visit Air Force aviation expo
U.S. Assistant Secretary of State Christopher Landau arrived in Ethiopia today as part of a regional tour that includes #Egypt, Ethiopia, #Kenya, and #Djibouti, scheduled to run from 24 January to 1 February.
The Commander of the U.S. Africa Command (#AFRICOM), General Dagvin Anderson, is also in Ethiopia as part of the visit.
Today, Landau and General Anderson visited the International Aviation Expo organized by the Ethiopian Air Force, according to the Ethiopian National Defense Force (#ENDF). Field Marshal Birhanu Jula, Chief of General Staff of the Ethiopian National Defense Force, also took part in the visit.
The expo showcased aircraft, defense technologies, and related products from the Ethiopian Air Force, the Defense Engineering Industry Group,..
https://www.facebook.com/AddisstandardEng/posts/pfbid021qedgKswfSFzdABsQXmFSvjuiRtWQedXpLYXJysCdk1MBnWvdx4JZJTmEng9jPGRl