Save as .3dm File with GH Python freezes GH

Hi there,

I just made a quick python script to do a save as of the rhino file into a directory.

It works, but then GH freezes after it runs, I can zoom in and out but nothing else.
Any ideas on what I’m doing wrong?

Here is the code

import rhinoscriptsyntax as rs
import Grasshopper as gh
import os

if Export:
    Output_Path = File_Path+S+File_Name
    if os.path.isdir(Output_Path) is False:
    filename = Output_Path+S+File_Name+'.3dm'

    cmd = "_-SaveAs " + chr(34) + filename + chr(34)
    rs.Command(cmd, True)
    end() (5.5 KB)

Try this