Writing import x simply imports the module. When using any class or function from the module x, you have to define the module name like x.foo(). Adding the as _x makes _x an alias of the imported module's name. So, instead of x.foo() you can now write _x.foo(). Note that with the alias, you cannot write x.foo().
This helps shortening the module names in cases of large module names such as matplotlib.pyplot or scipy.signal etc. It's certainly much easier to write and read plt.plot() than matplotlib.pyplot.plot().
I'm new to python and I've been seeing import x as _x. I would like to know how this is different from import x. Thanks!
Is there a difference between "import x" and "import x as _x"?