You should check if it's in `sys.modules`, not `globals`.