---
title: "Get or Create Sample"
id: "get-or-create-sample"
project: "MES User Manual"
url: "https://docs.sepasoft.com/articles/user-manual/get-or-create-sample"
updated: 2026-07-31T14:54:36Z
---

# Get or Create Sample

**Sepasoft MES Module Suite**
 #### Getting or Creating Sample Definitions

| ![Warning](/resources/Storage/user-manual/user-manual/Warning.png) | Stable Version: 3.81.5 and later<br><br>Release Candidate: 3.81.4 RC6 and later |
| --- | --- |


```python
#The following script sets a note and cause for a sample.
#You will need to pass the location path and sampleUUID for the sample that you are trying to add a note to.
locationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality' #You pass your location path
sampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3' #You pass your sampleUUID
sample = system.mes.spc.sample.getCreateByDefName(sampleUUID, '', locationPath)
print sample.getSampleUUID()
  
attrName = 'Broken' #You will need to replace this with the name of the attribute that the note is for
note = 'This is a New Scripted Sample note'
noteTaker = 'Phil'
cause = 'New Scripted Cause'
system.mes.spc.sample.setNote(sample, attrName, note, noteTaker)
system.mes.spc.sample.setCause(sample, attrName, cause, noteTaker) 
system.quality.definition.updateSampleDefinition(sampleDefinition)  
```


**Sepasoft MES Module Suite**