I can find my existing scripts in AGOL Contents. Are the scripts available once you open the Notebook. I would have expected them to be accessible through the Files are where the default home and samplesdata are or next to the Save button on the left.
Thanks
Brian
Hello Brian,
You might find this useful...
As part of our effort on the Living Atlas Team to create more Notebook specific content in online, we are starting to transfer existing Python scripts to Notebooks. But we quickly found that larger Python scripts can become a little unwieldy inside a Notebook.
To combat this, we pull out a majority of our code and store it as Python Code Sample items in online. This allows us to manage the code using an IDE of choice, make changes, and then update the Code Sample item with the changes. All while keeping the Notebook as light as possible.
Here’s where it gets interesting. Now that we have an online Python item, we can use a little Python logic in the Notebook to access the Code Sample, download it, and unzip the contents to the ‘/arcgis/home’ folder. Where it is managed and accessible across all of your Notebooks via the Kernel. The Notebook item below contains a Cell with two functions, one to manage the item contents in the home folder and another to remove it if you no longer need or want it. The manger can even update the imported module when it detects a change the next time you run the Notebook or trigger the manager.
Basically, it maintains a local cached copy of the Python item content in your account file folders. You just tell it what Item Id to pull down and manage. Then, simply Import the module(s) as usual to get at the Classes, Functions, and properties you are accustom to.
Best part about this technique, you can leverage any Python Code Sample that is accessible, enabling you to access reusable libraries and one off code alike.
Sample Notebook titled 'Manage Notebook Code Dependencies':
https://www.arcgis.com/home/item.html?id=46c7512604654601ab4338f9299c5414
Regards, Paul
The notebooks I'm referring to were created online. I can find the notebooks in My Content. What I'm asking about is once I'm in the Notebook mode, is there a way to get to my python files from within the Notebook instance or do I need to go to My Content to get to a new python program? Am I conflating Notebooks with python programs?
Hi Brian,
What format are your uploaded scripts in? Are they .ipynb? If so, they are converted to notebook items upon upload and you are able to navigate to them inside your Content page and open them into a new notebook. Are you looking to import or combine existing notebook items into a new notebook? You currently cannot do this from the files tab.
As for accessing your organisation content inside the notebook, the files tab in notebooks is separate from your AGOL content and is specifically intended for use with notebooks as a working environment. If you want to search for your organisation content inside the notebook you can either use 'Add' tab:
Or the ArcGIS API for Python:
Accessing and creating content | ArcGIS for Developers
In the notebook environment. In the files. As shown here I see /arcgis. Would this be a place to also opened up notebook files that I can find in Content? Thanks.
Can you give more information?
Did you create scripts within the notebook environment or are you talking about Python scripts that you had added?
Thanks,
Shannon
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.