Need help combining two python codes together for raspberry pi with a servo and ldr sensor : I have a python code running on my raspberry pi 2b and a light sensor, which measures the amount of time it takes for the capacitor of the light sensor to charge and send the pin high: 



    import RPi.GPIO as GPIO
    import time
    
    GPIO.setmode(GPIO.BOARD)
    
    pin_to_circuit = 7
    
    def rc_time (pin_to_circuit):
        count = 0
          
        #Output on the pin for 
        GPIO.setup(pin_to_circuit, GPIO.OUT)
        GPIO.output(pin_to_circuit, GPIO.LOW)
        time.sleep(0.1)
    
        #Change the pin back to input
        GPIO.setup(pin_to_circuit, GPIO.IN)
          
        #Count until the pin goes high
        while (GPIO.input(pin_to_circuit) == GPIO.LOW):
            count += 1
    
        if count > 1000000:
            return True
        else:
            return count
    
        
    
    
    #Catch when script is interrupted, cleanup correctly
    try:
    # Main loop
    while True:
        print rc_time(pin_to_circuit)
    except KeyboardInterrupt:
        pass
    finally:
        GPIO.cleanup()

What I want it to do is when the count goes higher than 1000000, a MG90S, that I have also connected to the pi and a 4AA battery pack, moves about 90 degrees. 
The code I was trying to integrate to move the servo:

    import RPi.GPIO as GPIO
    import time
    
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(12, GPIO.OUT)
    
    p.ChangeDutyCycle(7.5)  # turn towards 90 degree
    time.sleep(1) # sleep 1 second
    p.stop()
    GPIO.cleanup()

Could somebody help me combine these two python codes. I tried for a bit, but I have almost no python experience. It's probably quite easy to do, but I'm not able to do it myself. Thanks for the response in advance!