A molecular project is rarely just a structure. It may also depend on a sequence of preparation steps, analysis scripts, notes, and input files. When those pieces live in separate folders—or only in someone’s memory—a colleague may be able to open the model but struggle to repeat the work.
SAMSON offers a practical way to keep workflow files alongside a molecular project: embed scripts and folders in a SAMSON document. The document can then serve as a portable project container, while Python scripts provide a record of operations that can be run again.
Start with a small, clear script
You can run Python in SAMSON’s integrated Python Console or use the Code Editor to open, edit, and run a Python file. The Console is useful for trying a short command or exploring an idea interactively. For a workflow you expect to repeat or share, save the steps in a script: a named file is easier to inspect, revise, and include with the project.
Open the Console from Interface > Python Console. To work with a script, open the Code Editor from Interface > Code editor. The editor includes syntax highlighting and auto-completion, and its Run controls can execute Python files. SAMSON’s Python environment exposes the SAMSON Python API, so scripts can access SAMSON functionality as well as Python packages installed in that environment.

When building a script, make its purpose apparent to the next person. Use a descriptive filename, keep related files together, and add comments explaining the inputs and the intended result. These habits do not replace documentation, but they make it easier to understand what to run and why.
Use the interface to discover command code
You do not have to guess how to translate every interface action into Python. For some SAMSON commands, search for the command in the Find everything box. If the result indicates that the command is available as Python code, use its copy icon to copy that code into the Code Editor or Python Console. SAMSON also provides ways to copy Python code for color palettes and Visual Presets.
This can help turn a manual sequence into a repeatable script: perform or locate the relevant operation, copy its available Python code, then organize it into a readable file and test it in your project. The Code Editor’s templates and the Python Scripting Guide are useful places to look for further examples.

Keep project files with the document
Once your script and supporting files are ready, add them to the SAMSON document. Drag and drop files or folders into SAMSON and choose to embed them when prompted, or use Home > Embed files and Home > Embed folders. To edit an embedded Python script later, double-click it to open it in the Code Editor.
Embedding project materials keeps them inside the document instead of relying on a separate folder that might get left behind during transfer. For a colleague, student, or future you, that can make the project easier to inspect: the molecular model and its associated scripts and data travel together. SAMSON documents can be shared through channels such as email, GitHub, or SAMSON Connect documents.

Check what the document does—and does not—contain
Embedding a script and its input files is a useful step toward reproducibility, but it is worth checking the rest of the workflow before sharing. In particular, a document containing a Python script does not by itself tell a recipient which separately installed Python packages the script expects. SAMSON’s Package Manager lets you view installed packages and their versions, and install or uninstall packages using pip. Record any important package requirements with your project so someone else can check their environment.
For local packages, SAMSON’s Package Manager can install a valid package from a path. Editable/develop mode is intended for active package development; if you only need to use a package, the documentation advises leaving that mode unchecked. On some macOS installations, editable packages may not load on a later SAMSON launch, so check the documented warning if you use this option.
A simple sharing checklist helps: include the script, the files it reads, and enough notes to explain how to run it; identify any Python packages it needs; then reopen the document and check that the embedded files are present. This small review can save a collaborator from having to reconstruct your setup from scattered messages.
For details on the Python Console, package management, the Code Editor, and embedding files, see the SAMSON Scripting documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
