> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/scopeview/automation-api-and-scripting/use-python-scopeview-api/python-api-reference/data-source.md).

# Data Source

## Function: loadDataSource

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Load data source from provided source          |
| **Parameters** | **uri** (*str*) – data source location         |
| **Returns**    | Datasource name (string)                       |
| **Raises**     | **AssertionError** – Raises exception on error |

### **Example Usage**

{% code overflow="wrap" lineNumbers="true" %}

```python
# Connect to an open HyperWorks design
username = os.getlogin()
ecf_as_uri = HyWorksApi.getCurrentDesign().replace('\', '/')
datasource_uri = f"hw://localhost?hyWorks=/{username}/hyworks-1&designId={ecf_as_uri}"
data_source = ScopeViewApi.loadDataSource(datasource_uri)
```

{% endcode %}

## Function: loadFileDataSource

| **Section**    | **Description**                                       |
| -------------- | ----------------------------------------------------- |
| **Action**     | Load ScopeView data source                            |
| **Parameters** | **file\_name** (*str*) – path to data source location |
| **Returns**    | Datasource name (string)                              |
| **Raises**     | **AssertionError** – Raises exception on error        |

## Function: reloadAllDataSources

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Reload all ScopeView data sources              |
| **Parameters** | None                                           |
| **Returns**    | Error value (int)                              |
| **Raises**     | **AssertionError** – Raises exception on error |

## Function: removeAllDataSources

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Remove all ScopeView data sources              |
| **Parameters** | None                                           |
| **Returns**    | Error value (int)                              |
| **Raises**     | **AssertionError** – Raises exception on error |

## Function: replaceDataSource

| **Section**    | **Description**                                                                                                                                                         |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Replace ScopeView data source with provided source                                                                                                                      |
| **Parameters** | <p><strong>oldDataSourceLabel</strong> (<em>str</em>) – ScopeView data source label<br><strong>newDataSourceLocation</strong> (<em>str</em>) – data source location</p> |
| **Returns**    | Datasource name (string)                                                                                                                                                |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                          |

## Function: setDataSourceParameter

| **Section**    | **Description**                                                                                                                                                                                                                                                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Set an acquisition parameter for a custom data source which uses additional parameters                                                                                                                                                                                                                              |
| **Parameters** | <p><strong>dataSourceLabel</strong> (<em>str</em>) – The data source label. It should contain the brackets<br><strong>parameter</strong> (<em>str</em>) – The string parameter ID. The parameters are defined in the description of the relevant data sources.<br><strong>value</strong> (<em>str</em>) – value</p> |
| **Returns**    | Error value (int)                                                                                                                                                                                                                                                                                                   |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                                                                                      |

### **Example Usage**

{% code overflow="wrap" lineNumbers="true" %}

```python
HyWorksApi.ScopeView.setDataSourceParameter('[REC1]', 'timeLength', '0.4')
HyWorksApi.ScopeView.setDataSourceParameter('[OPA1]', 'triggerFunction', 'Level')
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/scopeview/automation-api-and-scripting/use-python-scopeview-api/python-api-reference/data-source.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
