Repository navigation
Plugin Python Console
Hiromichi Yokoyama edited this page Sep 5, 2026
·
3 revisions
Python Console embeds an interactive Python REPL directly within MoleditPy, providing live script execution, inspection of runtime objects, molecule manipulation via RDKit, and direct access to the PluginContext API.
| Repository | Bundled in moleditpy-plugins (plugins/Python_Console) |
| Author | HiroYokoyama |
| Supported OS | Windows, macOS, Linux, WSL |
| Supported Python | >=3.9, <3.15 |
| Menu location |
Plugin ▸ Python Console (or launchable via Plugin Manager) |
| Extra dependencies | None (uses RDKit, PyQt6 from MoleditPy) |
See Official Plugins for the full catalogue.
When opened, the interactive console injects convenient handles into the local namespace:
| Variable | Type | Description |
|---|---|---|
mol |
rdkit.Chem.Mol |
Current active molecule in MoleditPy (refreshed before every command execution) |
context |
PluginContext |
Official MoleditPy plugin API handle (recommended for stable access) |
mw |
MainWindow |
The host application's top-level main window |
Chem |
module | Direct reference to rdkit.Chem
|
help |
GUIHelp |
Non-blocking GUI-safe help utility |
# Atom count and properties
print("Atom count:", mol.GetNumAtoms())
for atom in mol.GetAtoms():
print(f"Atom {atom.GetIdx()}: {atom.GetSymbol()}, charge={atom.GetFormalCharge()}")
# Show a transient status message in MoleditPy's bottom bar
context.show_status_message("Hello from embedded Python Console!", 4000)from rdkit.Chem import AllChem
# Run an in-memory MMFF optimization and redraw 3D viewport
AllChem.MMFFOptimizeMolecule(mol)
context.draw_molecule_3d(mol)
# Or construct an entirely new molecule from SMILES
new_mol = Chem.MolFromSmiles("c1ccccc1CC(=O)O")
AllChem.EmbedMolecule(new_mol)
context.current_molecule = new_mol # Automatically updates 2D and 3D views- Enter: Execute the current single- or multi-line statement.
- Shift+Enter: Insert a line break to write indented code blocks, functions, or loops.
- Up / Down Arrows: Navigate command history.
- Syntax Highlighting: Built-in real-time color highlighting for Python keywords, strings, comments, and numbers.
- Official Plugins — the full plugin catalogue
- Plugin: MCP Server — programmatically control MoleditPy via Model Context Protocol
- Plugin: Plugin Installer — manage and update plugins
This page documents Python Console v2026.06.27, and was last updated on 2026-09-05. See REGISTRY/plugins.json for the current version.