Add notes on import.

pull/31/head
peterhinch 2023-01-14 16:57:24 +00:00
rodzic e5f1197c8a
commit 500b920f17
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -100,3 +100,12 @@ def reload(mod):
gc.collect()
__import__(mod_name)
```
## 4.1 Indirect import
The above code sample illustrates the method of importing a module where the
module name is stored in a variable:
```python
def run_test(module_name):
mod = __import__(module_name)
mod.test() # Run a self test
```