Import ====== The function :py:func:`extepy.reload` provides advanced module and object reloading capabilities for Python, so that developer can modify code without restarting the interpreter. It solves key limitations of Python's built-in reloading functionality by: * Supporting all import styles: ``import X``, ``import A as X``, ```from A import X``, and ``from A import B as X``. * Automatically updating references without requiring reassignment. * Offering granular control over namespace updates (global and/or local namespaces). .. autofunction:: extepy.reload **Examples:** Reload modules and/or objects .. code:: python import mymodule # ... modify mymodule.py ... from extepy import reload reload(mymodule) # reload module reload("mymodule") # reload module by name .. code:: python import mymodule as mymodule1 # ... modify mymodule.py ... from extepy import reload reload(mymodule1) # reload module alias .. code:: python from mymodule import myfunction # ... modify myfunction() in mymodule.py ... from extepy import reload reload(myfunction) # reload function .. code:: python from mymodule import myfunction as myfunction1 # ... modify myfunction() in mymodule.py ... from extepy import reload reload(myfunction1) # reload function alias .. code:: python from mymodule import myfunction as myfunction1, myfunction as myfunction2 # ... modify myfunction() in mymodule.py ... from extepy import reload reload(myfunction1) # update both myfunction1 and myfunction2 **Examples:** Update selective namespaces .. code:: python from extepy import reload myfunction = None # global reference def f(): global myfunction from mymodule import myfunction reload(myfunction, update_local=False) # update global reference only .. code:: python from extepy import reload def f(): from mymodule import myfunction # ... modify myfunction() in mymodule.py ... reload(myfunction, update_global=False) # update the local reference only .. code:: python from extepy import reload def f(): from mymodule import myfunction # ... modify myfunction() in mymodule.py ... reload(myfunction, update_global=False) # Update only the local calc reference