Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python changes are not reflected in a running app

I’ve decided to make a simple Telegram Bot in order to learn a bit of Python.
I have a main.py that imports and executes another file

#!/usr/bin/env python
import butlerr

if __name__ == '__main__':
    butlerr.main()

I run that file

> python src/main.py

But if I make a change in butlerr.py, that’s not reflected in the running app. I imagine I won’t see changes in a running app. It works if I stop the command and re-run it, obviously.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I figure that’s probably not the way to develop. Is there a more seamless way to make changes and see them immediately? I saw a blog post where they create like a web server, but I think that doesn’t work on my case.

I closed a question I previously made cause I thought it was a docker issue, but it was not.

>Solution :

What you are looking for is called hot-reloading.
every famous python framework has the hot-reloading option ( so you can turn it on and off )

first check if your package has this feature or not.

Then if it did not have hot-reloading option, you can run your python app using this package

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading