Reason for not allowing import twice but allowing reload()

alien2utoo at gmail.com alien2utoo at gmail.com
Sun Mar 6 03:31:39 EST 2016


>From the discussions in this thread, I get the impression that there are genuine
requirements to reload() a module during a program's execution.

It is fairly easy to see reload() in context of interactive execution, but how does it
come into picture in case of non-interactive Python program executions?

- one way could to be periodically poll for change of module version (time stamp etc.),
  and reload(),
- other could be sending a signal to program and reload() selected modules during
  processing of that signal by the program. Is it done this way in Python as well?

  There used to be programs which could reload the configuration file (and act
  accordingly) without needing to restart the program) when specific signal was sent
  to them.

Am I on right track in my understanding?
What are the other ways to accomplish reload() during the execution of a non-interactive Python program?



More information about the Python-list mailing list