Sharing Interactive Python Workflows in Molecular Models

Anyone working in molecular modeling knows the challenge: sharing not just a molecular structure but the entire interactive analysis pipeline. Whether you’re collaborating with colleagues, educating students, or preparing reproducible research, sending just the structure isn’t enough. What if your molecular file could carry your Python scripts, a GUI, and even documentation?

The SAMSON platform makes this possible through its support for embedding Python scripts and apps directly into molecular documents. This capability helps you bundle everything into a single, portable file—ideal for collaborative work, teaching, and publishing.

Why Consider Embedding?

Typically, sharing a modeling workflow involves multiple files: the structure file, the script, optional data or configuration files, maybe even documentation. This separation complicates things. Recipients need to recreate your environment, locate each component, and manually rerun steps.

With SAMSON, you can embed .py scripts and even entire folders inside a SAMSON Document. Think of it like a molecular container that holds computation, visualization, source code, and documentation together. Once embedded:

  • Your molecular file becomes self-contained.
  • You can double-click a script to open it in SAMSON’s integrated code editor.
  • Recipients don’t need to reassemble scattered parts—they can just open the document and run embedded apps immediately.

How to Embed a Script or App

You have two ways to embed files or folders:

  • Drag-and-drop files/folders into SAMSON. You’ll be prompted to choose between embedding and linking.
  • Use Home > Embed files or Home > Embed folders.

Embed file dialog

Once embedded, the files are accessible through the document interface. Scripts can be opened and executed directly within SAMSON’s built-in code editor, which features syntax highlighting, autocomplete, and integration with the Python Console.

What Can You Embed?

Here are some practical uses:

  • Collaborative research: Share a model and associated analysis pipeline in one file.
  • Reproducible science: Attach executable data analysis code to structures used in a publication.
  • Education: Create interactive exercises for students that combine written instructions and executable scripts.
  • Interactive tutorials: Provide a learning module where students can directly explore how modifications to code affect structure and visualization.

How to Open an Embedded Script

It’s simple: double-click any embedded script. It will open directly in the integrated code editor. From there, users can edit or run the code using the Run button or the built-in Python Console.

You can also embed a set of data files and configuration files alongside your script, so your entire app or workflow runs seamlessly across different machines.

Distribution Options

After embedding your scripts, you can distribute your SAMSON Document via:

This enables efficient sharing with collaborators and students, while ensuring that scripts and dependencies remain bundled together.

More Information

To learn more about script and app embedding, visit the official documentation page.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.