Simple Rhino macro run through ghpython disables grasshopper control

Hi I have a ghpython script that I’m trying to create to import pdf into Rhino using Rhino macro but after running the script my grasshopper panning gets disabled and the only way to get it back is by pressing the button connected to the python component with the solver locked (it’s expiring the solution of the python component?) If anyone has a insight into why this might be happening any help is appreciated. Thank you!
below is the code I have

import Rhino
import rhinoscriptsyntax as rs
def get_document_units():
    units = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem
    return str(units)

units = get_document_units()
print(units)

if Import:
    if units == "Inches":
        Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem = Rhino.UnitSystem.Millimeters
    rs.Command("!.")
    rs.Command("Import")
    rs.Command("Group")
    ghenv.Component.ExpireSolution(True)
    if units == "Millimeters":
        Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem = Rhino.UnitSystem.Inches

Import PDF.gh (2.8 KB)

Try this:

You can also try holding down the button till the process is done running, that usually works for me when e.g. capturing the viewport to an image.