Kay607 / obsidian-canvasblocks

MIT License
10 stars 0 forks source link

Request: Accessing Canvas File Name in Python Script #3

Open Salamantopo opened 3 days ago

Salamantopo commented 3 days ago

Hi,

First of all, I want to congratulate you on creating such an amazing plugin. CanvasBlocks has greatly enriched my work with Obsidian canvases.

I have a question: Is it possible to obtain the name of the canvas file within which a Python script is being executed using this plugin?

Thank you for your help!

Kay607 commented 3 days ago

It wasn't possible to but I just added this feature. You can now access the variable canvas_path in python to get the path to the file. The path will include the extension of the file .canvas. This is a relative path from the vault and not an absolute path so you may need to do something like os.path.join(vault_path, canvas_path) to get the full path for reading.

Salamantopo commented 3 days ago

Thank you so much!