Revit to Notion via Python

I am wanting to create a button to create a page in Notion.

I have the Notion API inserted but I am getting a Syntax error that I can’t figure out (I’m fairly new to Python still).

Here is the website that I was using to assist me with the code.

I was wondering if anyone could help me figure out the issue. My plan is to include UI via Data-Shapes once I get the Python code sorted.

Dynamo File →
Revit_to_Notion.dyn (6.8 KB)

So I installed Pycharm Community and cleaned up a few errors it showed, but it is still showing an ‘End of Line’ error on line 43.

What could the error possibly be?

One of the issues was that I needed to install the Requests package. I’m assuming I will need to do install it for use in Dynamo? How would I do that?

at line 47 there is a spare apostrophe

Haven’t delved into Notion API unfortunately, but I believe @john_pierson most likely has. The crew over at Speckle might have tips too if you reach out to them, they’ve whipped up a nifty speckle integration.

It appears to be a string formatting issue, at least to the point where the script fails. The apostrophe identified before might be the culprit but hard to say at face value (afk currently).

Its been quite a bit since I worked with it. But, what I did manage to do was here (for reading): GitHub - johnpierson/OkayNotionClient: This is an okay notion client for C# use.


How do I import these packages in dynamo?


I think the script was correct, I was just having issues importing those packages.

The method I usually use is as follows:

import sys
sys.path.append('directory path')

from package import *

Assuming your library is a .py file sitting in that directory that should provide access to all functions/methods/classes in that file. I believe if you want to treat it like a library with multiple files/init etc. then the approach may be a bit different… still learning about the options to this approach. Pip etc. aren’t really the same in Dynamo as far as I’m aware.

1 Like

So I am tabling this for the moment. It was a great idea that would be super handy given that we are needing to write notes in Notion while we model. It seemed pretty easy and straight-forward, especially after watching this tutorial on Youtube. I figured I could follow the steps in the video, add some UI with Data Structures, then we could have a button where we could add a page in Notion.

I can’t seem to figure it out at the moment though. I’ll be back though because I think this could be handy and useful for people.

I think I ran into a few issues as well when trying to integrate. Notion is a beast because objects are so Dynamic and can be nested (seemingly) infinite numbers of times.

The repo I linked above was kind of what I was starting to think to make sense of it all. Making it all object oriented.

So take Revit for example:

  • Wall (class of element)
    • Has properties like height and length
    • Can host other things, like doors


  • Page (class)
    • Properties
    • can host tables, etc.

Maybe I can get back to it eventually. But I do think you might have better luck if you were to use the JSON nodes in Dynamo 2.13.

Well the reason I was thinking it would be so simple was that I wasn’t wanting to link or tie anything from Revit to Notion. I was just wanting a button on the ribbon I made via Pyrevit that when you click on it a UI would appear where you could enter the Page Titile, Description, and Assignee. Then when you hit ‘enter’ that would create a new page in the ‘Revit Review’ database. That way I didn’t have to stop working in Revit and go over to Notion.

In the video I posted the guy walks you through entering the code as he does it for the first time and it works. So I figured I could follow him and enter those lines of code into the Python Node in Dynamo, create some Data-Base UIs, then place it in my Toolbar folder.

I think my issues were stemming from the packages you have to use and not knowing how to import them. It could also be my little experience with Python and not doing something correctly. I say that because I was having issues with the packages in Thonny and in PyCharm Community.

1 Like

So I couldn’t leave it alone (not sure why I thought I could, lol). I messed with it throughout the weekend and reached out for more help from the tutorial creator and on Reddit I officially have a working script!

I’ll revise it now to match the database I want to share it with and start working on the Revit part of it all. I’m debating if I want to continue down the route of Dynamo or look into the workflow that Erik Frits has been uploading videos about. That is using Python and running them through Pyrevit. I’m wondering if I won’t have the issues with requests and json going that route.

Here is the working script if anyone wants to check it out. →



Here is what I was missing at the beginning of my script---->

import sys


import requests as requests
import json as json

import sys

sys.path.append(r’C:\Users\(insert user name)\AppData\Local\Programs\Python\Python310\Lib\site-packages’)

import requests as requests
import json as json

Here is what the final script looked like and a link to the updated GitHub:

I still need to figure out the proper syntax to create tags, but for now I’m really tabling it for a bit since I know it works.


Called it! Glad to see it worked out for you. This is a handy technique when working with custom libraries in Python, I use it often when developing my own .py files. Sort of like building custom packages, but only calling them in when they’re needed.

1 Like

So, I had something interesting happen and I thought I would put it out there to see if anyone had any suggestions.

I got the script working, but then didn’t use it for a while. I decided to re-test it and it didn’t work. It said that it couldn’t import ‘requests’ because the module did not exist. I checked the folder location and it was there. What I did notice is that the windows explorer folder did not have the python folder, but the folder did exist in Google drive (Pretty much our entire server in via Drive). I did the only solution I know of which is to rename the file in Drive, the folder re-appears in the Windows Explorer folder, and then I renamed the folder back to what it was in Drive. I ran the script again and it didn’t work. So I plugged the script into Visual Studio, changed all the input variables to strings, ran the script and it worked.

So, obviously the script works but Dynamo is having some issue with accessing the drive folder. Any thoughts on why this is the case? I am thinking about talking to our Tech guy and asking his opinion on putting the dynamo folders on one of our computers. Twice now I have had Dynamo not work because the folder doesn’t exist in the Windows Explorer folder, but exists in Drive. The only solution our tech guy has is to rename the folders so they re-appear. Anyone else have this issue?