> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-science-lab/project/tabs-for-a-data-science-lab-project/tabs-for-pyspark-environment/utility.md).

# Utility

This tab allows to create and list the python scripts (.py files) that can be imported to your notebook.

{% hint style="info" %}
*Check out this walk-through on how to import a Utility scrip.*
{% endhint %}

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FHjwf5IOIGTLblg9C7qYt%2FUtility%20script.gif?alt=media&#x26;token=cf80b34d-20c4-4aa5-b53b-82a74884f7d6" alt=""><figcaption></figcaption></figure>

## Importing a Utility Script <a href="#importing-a-utility-script" id="importing-a-utility-script"></a>

* Navigate to the ***Utility*** tab for a Project.
* Click the ***Add Script*** option.

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FPWNAUCk8eFW57bYS56KV%2Fimage.png?alt=media&amp;token=4df7f4f5-4874-4dd0-8642-9b6bca2a9ec3" alt=""><figcaption></figcaption></figure>

* The ***Add utility script*** page opens.
* Provide the following information:
  * Utility Name
  * Utility Description
  * Utility Script
* Click the ***Save*** option.

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FnKom1kNKlIfJcrgODKUL%2Fimage.png?alt=media&amp;token=e083fd4e-0275-4c4d-a0ee-202fb3a5e29e" alt=""><figcaption><p>The Add Utility Script form to provide the required details</p></figcaption></figure>

* A confirmation message appears.
* The newly created Utility Script gets added to the Utility list.

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FSryGpfDwsfy7jIFWwtZ4%2Fimage.png?alt=media&amp;token=b38a7302-b807-47a1-81dd-f5509876a536" alt=""><figcaption><p>The newly imported Utility script lists under the Utility list</p></figcaption></figure>

## Importing the Utility Script inside a Notebook <a href="#importing-the-utility-script-inside-a-notebook" id="importing-the-utility-script-inside-a-notebook"></a>

* Copy a utility script name using the Utility list.
* Navigate to the Notebook tab.

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FLhsN3bnphhgkZJf86eRY%2Fimage.png?alt=media&amp;token=daf20ad7-1884-48ff-b6c8-d759028e2064" alt=""><figcaption></figcaption></figure>

* Create a Notebook or open an existing Notebook and navigate to the Notebook page.
* Add a ***Code*** ***cell***.
* Write code to import data with specific class.
* Provide the Utility script as the resource to get data.
* Specify the variables to get the class and get the data in the next code cell.
* Provide print function to see the data.
* Run all the cells.
* You can get the output below.​

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FZIHeQHP2THmgaoO8cts2%2Fimage.png?alt=media&amp;token=2e085840-6a52-4a05-b3db-71fb2c7816d9" alt=""><figcaption></figcaption></figure>

## Updating the Utility Script

* Navigate to the ***Utility*** tab.
* Select an uploaded utility script from the list.
* Click the ***Edit*** icon.    &#x20;

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FdzbQEGa6aw6KlV0JJ0Rp%2Fimage.png?alt=media&amp;token=0335c040-c13b-4611-ab50-d1984ba2d83a" alt=""><figcaption></figcaption></figure>

* The ***Update Utility Script*** page opens.
* &#x20;The Utility script content gets displayed. The user can modify the content if needed.
* Click the ***Update*** option.

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FCFlTI28aBG9LdtRc2OiK%2Fimage.png?alt=media&amp;token=22a479b1-3a9c-447a-84a5-ef52b792a9e8" alt=""><figcaption></figcaption></figure>

* A success message appears.
* The selected Utility script gets updated.

<figure><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FxyiWLU9Aki0psl7PCDZW%2Fimage.png?alt=media&amp;token=f5316ca0-d298-4b96-9126-e5ee001dffc5" alt=""><figcaption></figcaption></figure>

**Actions Provided on the Utility List Page**

<table><thead><tr><th width="99.33333333333331">Icon</th><th width="93">Name</th><th>Actions</th></tr></thead><tbody><tr><td><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2F46xzAb9rm0dU3edEFnLW%2Fimage.png?alt=media&amp;token=60331b47-d987-4da7-84c2-50035297e6e5" alt=""></td><td>Edit</td><td>Redirects the user to the Update Utility Script page.</td></tr><tr><td><img src="https://1025450693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Figrg2b2URgwMO5YmejDu%2Fuploads%2FC6ABMUhgovLaKSHpCy1x%2Fimage.png?alt=media&amp;token=ae7686b3-901f-4829-950f-f648a096f20b" alt=""></td><td>Delete</td><td>Prompts to delete the selected Utility Script.</td></tr></tbody></table>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Refer the **Data Science Lab Quick Start Flow** page to get an overview of the **Data Science Lab** module in nutshell.* [***Click here***](https://docs.bdb.ai/data-science-lab/data-science-lab-quick-start-flow) *to get redirected to the quick start flow page.*
{% endhint %}
