The code is like this:
import numpy as np
def f1():
    if False:
        del np
        import numpy as np
    return np.zeros(1)
if __name__=="__main__":
    a = f1()
When I run this code, I get the error message:
UnboundLocalError: local variable 'np' referenced before assignment
Why does 'np' become local?
The "if False" block should not affect my program at all, since it cannot be executed.
But when I delete the "if" block, the code works.
 
    