Opentrons OT-2 variable sample count

Hello everyone, and Happy New Year!

I am relatively new to this, and I hope my question hasn’t been asked already. We have the OT-2 in our laboratory and are planning to use it for some tests in our routine testing (for example, LaCar testing). I am working with the Python API.

I understand the basics of programming and have already written a functional program. My question is: Is there a way in the Opentrons app to make the program automatically adjust to different numbers of samples, or do I need to write separate programs for each sample count? This seems a bit unintuitive to me.

I would greatly appreciate any help or tips.
Thank you!

1 Like

Hi there Malo

If you want users to input a different sample amount, there’s no native function for this.

I have it set up so the user fills in a google sheet and then we pull the csv data from that using the gspread library and parse out variables and values. So then whenever the user updates the google sheet, the robot will load a different number of plates

Alternatively, a simple solution is just have your python script locally on your opentrons PC and just set a variable, say, NUM_PLATES = 3 at the top (or NUM_TUBES, whatever).

Then just change and upload a new protocol each time you run your program.

If you do it in a way where the python file itself pulls from somewhere else, you don’t need to keep uploading new protocols.

Happy to answer more questions if you have them


in order to not write separate programs your opentrons would need to import information from a file. Please note opentrons does not have access to your computer. You would need to put the file in the jupyter directory (run jupyter from the opentrons app).

1 Like

The way I’ve solved this is by generating new python file at user’s request in webapp.

I’d prefer if opentrons had at least a simple selection like “how many plates” in the launch interface.


Genie LabOS is now natively integrated with the OT-2 and Flex. Defining parameters and having a user input information at run time is now available, along with many other features/benefits (like error handling). Feel free to reach out to me to learn how to make this possible for your lab.


Thank you everyone for your responses, they were truly helpful! I managed to resolve the issue by uploading a file to the Opentrons system. The script then retrieves the necessary information. Admittedly, this isn’t the ideal solution as it somewhat hinders the workflow, but it works for now


@malo123, are you utilizing the app to run protocols or running protocols outside the app? There are some nuances to using the former setup that I might be able to help you avoid.

1 Like