I'm having trouble importing my custom functions into Jupyter Notebook, and would appreciate help.
It seems to me that the Notebook works on the first copy of the imported file, and doesn't recognise any subsequent changes. Here's the process I use to demonstrate the behaviour with the attached project:
- In file.py, start with Func1() uncommented and Func2() commented out.
- In the Notebook, 'from file1 import *'
- Run all cells and see that Func1() is accessible and Func2() is not, as expected.
- Edit file1.py by commenting out Func1() and uncommenting Func2().
- In the Notebook, restart the kernel and run all cells. See that Func1() remains accessible and Func2() is not, i.e. no change in behaviour despite the change to file1.py.
I'm probably missing something here, but I've tried building and backtesting the project, closing/opening the project, logging out/in from QuantConnect, but all the time the behaviour reflects the first version of file1.
Any ideas?
Tony
Tony Shacklock
It looks like the project wasn't attached so here it is.
Tony
Varad Kabade
Hi Tony Shacklock,
When the file has been changed, we need to stop the research node manually. To do so, open the Resources tab on the right side of the IDE, then click the stop button next to the research node and refresh the browser.
Best,
Varad Kabade
Tony Shacklock
Hi Varad
Many thanks. Easy when you know!
I'll have to change the way I work. I've been trying to write my functions in the Algorithm Lab, but it will be better to prototype them in the Notebook first.
Cheers, Tony
Tony Shacklock
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!