I don't know how IDLE made it work, but you have one file in */home/pi/* (*ifsample.py*) and the other in */home/pi/Desktop/* (*test.py*); that's unlikely to give good results. It probably would work if you started *test.py* from directory */home/pi*, which might be what IDLE did, but Geany defaults to running in the file's own directory, which is */home/pi/Desktop* here. Python has no way to know it should look into */home/pi*, as it's not a default search path and you didn't explicitly tell it to.