Как работает функция 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
🌐 Gumart Goes Global: GuGoGlobal Official Recap 🎬
From the streets of Paris to the shores of Cape Town, GuGoGlobal wasn’t just a campaign — it was a movement. 🕯
📌 Campaign Impact:
🌐 5 continents, 20+ cities
👥 100,000+ Gumart residents participated
🎁 $25,000+ in rewards distributed
🚀 Hundreds of check-in videos from real users
🙏 Thank you to every Gumart Resident, partner, and friend around the world who made this campaign unforgettable.
Your energy, creativity, and belief in our vision are what bring Web3 to life — city by city, step by step.💸☄️
#GuGoGlobal#Gumart
🗺Where will you swipe next?
💳GuPay is still live — where will you swipe next?
New York, Seoul, Manila, Miami… — We’ve already seen GuCard go global. 🌎
But for us, every payment counts — whether it's coffee near home or a flight across borders
📌 Let's share some moments with us:
1️⃣Use GuCard this week.
2️⃣Snap a photo and post to your X .
3️⃣Use hashtag #Gumart#GuPay
Let’s show the world what crypto can actually do.🛒
✨🥳 GUCARD CREATIVE CONTEST IS HERE! 🥳✨
Are you ready to show off your creativity and love for Gumart? 💸 Join the Gucard Creative Contest and turn your ideas into amazing content! 🎥🖌
👍 How to Join:
1️⃣ Create unique content (video, photo, meme, or text) featuring Gucard or Gumart.
2️⃣ Post it on X or YouTube with the hashtag #Gucard#Gumart
🏆Prizes Await You:
🎖Main Prizes:
1st Place: 1,000 USDT (1 winner)
2nd Place: $500 USDT (3 winners)
3rd Place: $50 USDT (5 winners)
🌟 Community Choice Awards:
50 winners: $10 each (based on community engagement).
💳 Special Bonus: All winners will receive a free Gucard!
🗓Timeline:
🕐 Start: January 5, 2025
⏳ End: January 19, 2025
🔥 Criteria for Winning: Creativity, quality, and interaction - bring your A-game!
#GuMinigame
‼10,000+ TRANSACTIONS IN 20 DAYS 🤑
GuPay Team Cup – FIFA Club World Cup 2025 is going global - and it’s powered by BNB Chain ⚡️
From Real Madrid to Man City, 32 legendary football clubs are battling it out. But this time, it's not just on the field — it's on-chain. 🏟
📣 Gumart is rewriting what mass adoption looks like:
10,000+ real-world transactions made through GuPay across hotels, stores, and events — all in less than 3 weeks.⬆️
🚀 Built on BNB Chain's trusted infrastructure, Gumart is leading the charge in making crypto usable, visible, and impactful in everyday life.
➖Want to join?
Pick your team and make transactions with GuPay. Help your squad rise to the top.
🌐 Be where culture, payments, and crypto collide.
#GuPayTeamCup#Gumart#BNBChain
🎬 Gumart is in Paris Blockchain Week 2025 🇫🇷
#GuGoGlobal campaign – a journey to take Gumart around the world and bring Web3 adoption closer to real life!
📍 First Stop: Paris Blockchain Week 2025
Our team just landed in Paris, the heart of innovation and fashion, to showcase Gumart at one of the most prestigious Web3 events in the world! From networking with top-tier founders and VCs to sharing the stage with the best builders in the space, Gumart is here to make waves.
🎥👉 Watch the highlight video from our Paris mission – and feel the energy!
💡We’re on a mission to show the world how Gumart is building the future of crypto payments, e-commerce, and DeFi — one region at a time. Real people. Real places. Real utility.
🚀 Next stop? Maybe your city. Don’t blink 👀
Let’s take Web3 mainstream – together 🌐
#GuGoGlobal#Gumart#PBW2025#Web3Adoption#ParisBlockchainWeek#CryptoInRealLife