Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart kernel in VSCode to completely reload imports?

When I change an imported python script when running cell by cell imports doesn't work until I restart the whole program VSCode. I tried to kill kernel and restart it, saved changes - nothing works, only restarting is need. But it isn't too quick and appropriate to restart it each time I change the code. Is there any way to apply changes in imported scripts? I am on linux lubuntu 20.04.

like image 907
Nikolay Yasinskiy Avatar asked Oct 17 '25 00:10

Nikolay Yasinskiy


1 Answers

This works for me:

%load_ext autoreload
%autoreload 2

Execute those lines after your imports and any saved changes you make to the external file you are importing should get automatically reflected.

like image 83
footfalcon Avatar answered Oct 19 '25 14:10

footfalcon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!