Python Scripter: Add your custom Python scripts to Obsidian as commands!

This is a script I was looking for in the past and you might be looking for as well if you are a software developer or just someone who loves to hack stuff together with code.

This plugin lets you add your own custom python scripts to obsidian to be ran as simply as from a keyboard shortcut like any other command.


The following script was used:

import sys
import os

python_script = sys.argv[0]
file_path = sys.argv[2]
vault_path = sys.argv[1]

abs_file_path = os.path.abspath(os.path.join(vault_path, file_path))

print(f"This is the open file: {abs_file_path}")

with open(abs_file_path, "a") as f:
    f.write("This was written by a script")

This is currently available here or in the community plugins tab in Obsidian


Hi, this looks very interesting! I recently migrated from WikidPad which was written in Python. I wrote a selection of plugins (in python) for WP that accessed the selected text and wrote to the clipboard as well.

Would that be possible using this setup? I know my way around Python but I have never coded js or electron.

Found another thread where acessing clipboard is discussed.