import function

suggest change

The __import__() function can be used to import modules where the name is only known at runtime

if user_input == "os":
    os = __import__("os")

# equivalent to import os

This function can also be used to specify the file path to a module

mod = __import__(r"C:/path/to/file/anywhere/on/computer/module.py")

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents