Shihui Guo

Different Ways of Importing Modules in Python

There are several ways for you to import modules into python, but they will determine how you can reference the attributes inside the modules. Take the math module for example:

The choice is up to you!

Note, if you choose this way:

import yourmodule

After you made changes to the code on the fly, reload is like:


If you only imported part of the module, say a function. What I did is to pop up the module from the system path, and then reload it. Anyone who knows a better solution, please leave a message to me

import sys
from yourmodule import yourfunction