I made a clock circuit with a 555 timer ic, then I measured the wavelength of the square wave generated using my Raspberry Pi.
At first I connected the ground of the RPi to the ground of the circuit. To measure the wavelength, And it worked fine. But then I removed the pin connecting the grounds and tried to measure and IT WORKED!
The python(V-3.5) code is:

    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    
    while True:
    	if GPIO.input(18) == GPIO.HIGH:
    		print('detected')
    GPIO.cleanup()

I am baffled by this because the raspberry pi is connected to the phone adapter which is plugged in in the mains, and the circuit is connected to a power bank.  
Circuit-
[![enter image description here][1]][1]
It is the exact replica of this: https://youtu.be/SmQ5K7UQPMM (video that shows how it is put together)

Also if this question is very noob I am sorry but I am still in high school.


  [1]: https://i.sstatic.net/gDRA5.jpg