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