Python import as Keyword

Using import [module name] as [alias] will import the Python module and alias the module name.

Python
import myModule as myAlias

Example

Let's say you have a file called "moduleToImport.py" that looks like this:

Python
class ImportedClass():
    def sayHello(self):
        print('hello')

the module name is "moduleToImport" which can be used like this:

Python
import moduleToImport as m
myImportedClass = m.ImportedClass()
myImportedClass.sayHello()

Output

Hello

Notice how "m" aliases the module name "moduleToImport."