In Perl, we have the @INC
subroutine trigger that allows executing a subroutine when it's loaded through use
or require
. When is a subroutine reference in @INC called?
Is there something similar in Python? For example, if I have a file test_random.py
which has import random
statement in it; is it possible for me to insert functionX()
in sys.path
so that when Python searches for random
in sys.path, it'll run functionX()
before it finds random
?