[{"data":1,"prerenderedAt":1163},["ShallowReactive",2],{"doc-\u002Fhow-to\u002Fhow-to-import-a-module-in-python":3},{"id":4,"title":5,"body":6,"description":1156,"extension":1157,"meta":1158,"navigation":73,"path":1159,"seo":1160,"stem":1161,"__hash__":1162},"content\u002Fhow-to\u002Fhow-to-import-a-module-in-python.md","How to Import a Module in Python",{"type":7,"value":8,"toc":1124},"minimark",[9,13,17,20,38,41,46,147,154,160,164,167,170,173,192,200,205,211,214,268,271,286,291,302,315,321,324,360,362,371,380,384,387,390,397,404,409,466,468,483,486,497,503,507,510,517,522,569,575,618,620,635,638,656,664,681,684,688,691,694,728,731,745,748,819,822,854,861,865,868,892,896,904,907,921,924,935,939,946,958,961,964,980,984,987,998,1001,1018,1022,1034,1041,1049,1053,1061,1067,1070,1077,1080,1084,1117,1120],[10,11,5],"h1",{"id":12},"how-to-import-a-module-in-python",[14,15,16],"p",{},"Importing a module lets you use code that already exists instead of writing everything yourself.",[14,18,19],{},"In Python, modules can be:",[21,22,23,27,30],"ul",{},[24,25,26],"li",{},"built-in modules that come with Python",[24,28,29],{},"installed packages from outside Python",[24,31,32,33,37],{},"your own ",[34,35,36],"code",{},".py"," files",[14,39,40],{},"This guide shows you how to import modules, use functions from them, and avoid common beginner mistakes.",[42,43,45],"h2",{"id":44},"quick-answer","Quick answer",[47,48,53],"pre",{"className":49,"code":50,"language":51,"meta":52,"style":52},"language-python shiki shiki-themes material-theme-lighter github-light github-dark","import math\n\nprint(math.sqrt(16))\n\nfrom random import randint\nprint(randint(1, 10))\n","python","",[34,54,55,68,75,105,110,124],{"__ignoreMap":52},[56,57,60,64],"span",{"class":58,"line":59},"line",1,[56,61,63],{"class":62},"sVHd0","import",[56,65,67],{"class":66},"su5hD"," math\n",[56,69,71],{"class":58,"line":70},2,[56,72,74],{"emptyLinePlaceholder":73},true,"\n",[56,76,78,82,86,90,93,96,98,102],{"class":58,"line":77},3,[56,79,81],{"class":80},"sptTA","print",[56,83,85],{"class":84},"sP7_E","(",[56,87,89],{"class":88},"slqww","math",[56,91,92],{"class":84},".",[56,94,95],{"class":88},"sqrt",[56,97,85],{"class":84},[56,99,101],{"class":100},"srdBf","16",[56,103,104],{"class":84},"))\n",[56,106,108],{"class":58,"line":107},4,[56,109,74],{"emptyLinePlaceholder":73},[56,111,113,116,119,121],{"class":58,"line":112},5,[56,114,115],{"class":62},"from",[56,117,118],{"class":66}," random ",[56,120,63],{"class":62},[56,122,123],{"class":66}," randint\n",[56,125,127,129,131,134,136,139,142,145],{"class":58,"line":126},6,[56,128,81],{"class":80},[56,130,85],{"class":84},[56,132,133],{"class":88},"randint",[56,135,85],{"class":84},[56,137,138],{"class":100},"1",[56,140,141],{"class":84},",",[56,143,144],{"class":100}," 10",[56,146,104],{"class":84},[14,148,149,150,153],{},"Use ",[34,151,152],{},"import module_name"," to load a module.",[14,155,149,156,159],{},[34,157,158],{},"from module_name import something"," when you only need specific names.",[42,161,163],{"id":162},"what-importing-a-module-means","What importing a module means",[14,165,166],{},"A module is a Python file that contains reusable code.",[14,168,169],{},"When you import a module, Python makes that code available in your program.",[14,171,172],{},"Many useful modules come with Python, including:",[21,174,175,180,186],{},[24,176,177,179],{},[34,178,89],{}," for math functions",[24,181,182,185],{},[34,183,184],{},"random"," for random values",[24,187,188,191],{},[34,189,190],{},"sys"," for Python system information",[14,193,194,195,92],{},"If you are new to this topic, see ",[196,197,199],"a",{"href":198},"\u002Flearn\u002Fpython-modules-explained","Python modules explained",[42,201,149,203],{"id":202},"use-import-module_name",[34,204,152],{},[14,206,207,208,210],{},"Write ",[34,209,63],{}," followed by the module name.",[14,212,213],{},"Then use the module's functions with dot notation.",[47,215,217],{"className":49,"code":216,"language":51,"meta":52,"style":52},"import math\n\nprint(math.sqrt(25))\nprint(math.ceil(4.2))\n",[34,218,219,225,229,248],{"__ignoreMap":52},[56,220,221,223],{"class":58,"line":59},[56,222,63],{"class":62},[56,224,67],{"class":66},[56,226,227],{"class":58,"line":70},[56,228,74],{"emptyLinePlaceholder":73},[56,230,231,233,235,237,239,241,243,246],{"class":58,"line":77},[56,232,81],{"class":80},[56,234,85],{"class":84},[56,236,89],{"class":88},[56,238,92],{"class":84},[56,240,95],{"class":88},[56,242,85],{"class":84},[56,244,245],{"class":100},"25",[56,247,104],{"class":84},[56,249,250,252,254,256,258,261,263,266],{"class":58,"line":107},[56,251,81],{"class":80},[56,253,85],{"class":84},[56,255,89],{"class":88},[56,257,92],{"class":84},[56,259,260],{"class":88},"ceil",[56,262,85],{"class":84},[56,264,265],{"class":100},"4.2",[56,267,104],{"class":84},[14,269,270],{},"Expected output:",[47,272,274],{"className":49,"code":273,"language":51,"meta":52,"style":52},"5.0\n5\n",[34,275,276,281],{"__ignoreMap":52},[56,277,278],{"class":58,"line":59},[56,279,280],{"class":100},"5.0\n",[56,282,283],{"class":58,"line":70},[56,284,285],{"class":100},"5\n",[287,288,290],"h3",{"id":289},"why-this-style-is-useful","Why this style is useful",[21,292,293,296,299],{},[24,294,295],{},"It is clear where a function came from.",[24,297,298],{},"It reduces name conflicts.",[24,300,301],{},"It is common in real Python code.",[14,303,304,305,308,309,311,312,314],{},"For example, ",[34,306,307],{},"math.sqrt()"," clearly shows that ",[34,310,95],{}," comes from the ",[34,313,89],{}," module.",[42,316,149,318],{"id":317},"use-from-module_name-import-name",[34,319,320],{},"from module_name import name",[14,322,323],{},"You can import only the function, class, or variable you need.",[47,325,327],{"className":49,"code":326,"language":51,"meta":52,"style":52},"from math import sqrt\n\nprint(sqrt(36))\n",[34,328,329,341,345],{"__ignoreMap":52},[56,330,331,333,336,338],{"class":58,"line":59},[56,332,115],{"class":62},[56,334,335],{"class":66}," math ",[56,337,63],{"class":62},[56,339,340],{"class":66}," sqrt\n",[56,342,343],{"class":58,"line":70},[56,344,74],{"emptyLinePlaceholder":73},[56,346,347,349,351,353,355,358],{"class":58,"line":77},[56,348,81],{"class":80},[56,350,85],{"class":84},[56,352,95],{"class":88},[56,354,85],{"class":84},[56,356,357],{"class":100},"36",[56,359,104],{"class":84},[14,361,270],{},[47,363,365],{"className":49,"code":364,"language":51,"meta":52,"style":52},"6.0\n",[34,366,367],{"__ignoreMap":52},[56,368,369],{"class":58,"line":59},[56,370,364],{"class":100},[14,372,373,374,377,378,92],{},"With this style, you call ",[34,375,376],{},"sqrt()"," directly instead of writing ",[34,379,307],{},[287,381,383],{"id":382},"when-to-use-this","When to use this",[14,385,386],{},"This can be useful in short scripts and simple examples.",[14,388,389],{},"But in larger files, it can be less clear because you do not see the module name before the function.",[14,391,392,393,92],{},"If you want to understand this more deeply, read ",[196,394,396],{"href":395},"\u002Flearn\u002Fhow-import-works-in-python","how import works in Python",[42,398,400,401],{"id":399},"rename-a-module-with-as","Rename a module with ",[34,402,403],{},"as",[14,405,406,407,92],{},"You can give a module a shorter name with ",[34,408,403],{},[47,410,412],{"className":49,"code":411,"language":51,"meta":52,"style":52},"import math as m\n\nprint(m.sqrt(49))\nprint(m.pi)\n",[34,413,414,425,429,449],{"__ignoreMap":52},[56,415,416,418,420,422],{"class":58,"line":59},[56,417,63],{"class":62},[56,419,335],{"class":66},[56,421,403],{"class":62},[56,423,424],{"class":66}," m\n",[56,426,427],{"class":58,"line":70},[56,428,74],{"emptyLinePlaceholder":73},[56,430,431,433,435,438,440,442,444,447],{"class":58,"line":77},[56,432,81],{"class":80},[56,434,85],{"class":84},[56,436,437],{"class":88},"m",[56,439,92],{"class":84},[56,441,95],{"class":88},[56,443,85],{"class":84},[56,445,446],{"class":100},"49",[56,448,104],{"class":84},[56,450,451,453,455,457,459,463],{"class":58,"line":107},[56,452,81],{"class":80},[56,454,85],{"class":84},[56,456,437],{"class":88},[56,458,92],{"class":84},[56,460,462],{"class":461},"skxfh","pi",[56,464,465],{"class":84},")\n",[14,467,270],{},[47,469,471],{"className":49,"code":470,"language":51,"meta":52,"style":52},"7.0\n3.141592653589793\n",[34,472,473,478],{"__ignoreMap":52},[56,474,475],{"class":58,"line":59},[56,476,477],{"class":100},"7.0\n",[56,479,480],{"class":58,"line":70},[56,481,482],{"class":100},"3.141592653589793\n",[14,484,485],{},"This is helpful when:",[21,487,488,491,494],{},[24,489,490],{},"the module name is long",[24,492,493],{},"you want shorter code",[24,495,496],{},"a short alias is commonly used",[14,498,304,499,502],{},[34,500,501],{},"import math as m"," works, though many real-world aliases are even more common with other libraries.",[42,504,506],{"id":505},"import-your-own-python-file","Import your own Python file",[14,508,509],{},"You can also import your own file.",[14,511,512,513,516],{},"If you have a file named ",[34,514,515],{},"helpers.py"," in the same folder as your script, you can import it like this:",[287,518,520],{"id":519},"helperspy",[34,521,515],{},[47,523,525],{"className":49,"code":524,"language":51,"meta":52,"style":52},"def greet(name):\n    return f\"Hello, {name}!\"\n",[34,526,527,546],{"__ignoreMap":52},[56,528,529,533,537,539,543],{"class":58,"line":59},[56,530,532],{"class":531},"sbsja","def",[56,534,536],{"class":535},"sGLFI"," greet",[56,538,85],{"class":84},[56,540,542],{"class":541},"sFwrP","name",[56,544,545],{"class":84},"):\n",[56,547,548,551,554,558,561,563,566],{"class":58,"line":70},[56,549,550],{"class":62},"    return",[56,552,553],{"class":531}," f",[56,555,557],{"class":556},"s_sjI","\"Hello, ",[56,559,560],{"class":100},"{",[56,562,542],{"class":66},[56,564,565],{"class":100},"}",[56,567,568],{"class":556},"!\"\n",[287,570,572],{"id":571},"mainpy",[34,573,574],{},"main.py",[47,576,578],{"className":49,"code":577,"language":51,"meta":52,"style":52},"import helpers\n\nprint(helpers.greet(\"Sam\"))\n",[34,579,580,587,591],{"__ignoreMap":52},[56,581,582,584],{"class":58,"line":59},[56,583,63],{"class":62},[56,585,586],{"class":66}," helpers\n",[56,588,589],{"class":58,"line":70},[56,590,74],{"emptyLinePlaceholder":73},[56,592,593,595,597,600,602,605,607,611,614,616],{"class":58,"line":77},[56,594,81],{"class":80},[56,596,85],{"class":84},[56,598,599],{"class":88},"helpers",[56,601,92],{"class":84},[56,603,604],{"class":88},"greet",[56,606,85],{"class":84},[56,608,610],{"class":609},"sjJ54","\"",[56,612,613],{"class":556},"Sam",[56,615,610],{"class":609},[56,617,104],{"class":84},[14,619,270],{},[47,621,623],{"className":49,"code":622,"language":51,"meta":52,"style":52},"Hello, Sam!\n",[34,624,625],{"__ignoreMap":52},[56,626,627,630,632],{"class":58,"line":59},[56,628,629],{"class":66},"Hello",[56,631,141],{"class":84},[56,633,634],{"class":66}," Sam!\n",[14,636,637],{},"Important points:",[21,639,640,643,648],{},[24,641,642],{},"Put both files in the same folder.",[24,644,645,646,92],{},"Use the filename without ",[34,647,36],{},[24,649,650,652,653,92],{},[34,651,515],{}," becomes ",[34,654,655],{},"import helpers",[14,657,658,659,663],{},"Do ",[660,661,662],"strong",{},"not"," write this:",[47,665,667],{"className":49,"code":666,"language":51,"meta":52,"style":52},"import helpers.py\n",[34,668,669],{"__ignoreMap":52},[56,670,671,673,676,678],{"class":58,"line":59},[56,672,63],{"class":62},[56,674,675],{"class":66}," helpers",[56,677,92],{"class":84},[56,679,680],{"class":461},"py\n",[14,682,683],{},"That is invalid syntax for imports.",[42,685,687],{"id":686},"how-to-check-that-the-import-worked","How to check that the import worked",[14,689,690],{},"The simplest way is to run your script and use something from the module.",[14,692,693],{},"For example:",[47,695,697],{"className":49,"code":696,"language":51,"meta":52,"style":52},"import math\n\nprint(math.sqrt(64))\n",[34,698,699,705,709],{"__ignoreMap":52},[56,700,701,703],{"class":58,"line":59},[56,702,63],{"class":62},[56,704,67],{"class":66},[56,706,707],{"class":58,"line":70},[56,708,74],{"emptyLinePlaceholder":73},[56,710,711,713,715,717,719,721,723,726],{"class":58,"line":77},[56,712,81],{"class":80},[56,714,85],{"class":84},[56,716,89],{"class":88},[56,718,92],{"class":84},[56,720,95],{"class":88},[56,722,85],{"class":84},[56,724,725],{"class":100},"64",[56,727,104],{"class":84},[14,729,730],{},"If the import works, Python runs the code normally.",[14,732,733,734,737,738,92],{},"If Python cannot find the module, you may get a ",[34,735,736],{},"ModuleNotFoundError",". See ",[196,739,741,742],{"href":740},"\u002Ferrors\u002Fmodulenotfounderror-no-module-named-x-fix","how to fix ",[34,743,744],{},"ModuleNotFoundError: No module named x",[14,746,747],{},"Useful commands for testing imports:",[47,749,753],{"className":750,"code":751,"language":752,"meta":52,"style":52},"language-bash shiki shiki-themes material-theme-lighter github-light github-dark","python your_script.py\npython -c \"import math; print(math.sqrt(25))\"\npython -c \"import sys; print(sys.path)\"\npip show requests\npython -m pip install requests\n","bash",[34,754,755,763,780,793,804],{"__ignoreMap":52},[56,756,757,760],{"class":58,"line":59},[56,758,51],{"class":759},"sbgvK",[56,761,762],{"class":556}," your_script.py\n",[56,764,765,767,771,774,777],{"class":58,"line":70},[56,766,51],{"class":759},[56,768,770],{"class":769},"stzsN"," -c",[56,772,773],{"class":609}," \"",[56,775,776],{"class":556},"import math; print(math.sqrt(25))",[56,778,779],{"class":609},"\"\n",[56,781,782,784,786,788,791],{"class":58,"line":77},[56,783,51],{"class":759},[56,785,770],{"class":769},[56,787,773],{"class":609},[56,789,790],{"class":556},"import sys; print(sys.path)",[56,792,779],{"class":609},[56,794,795,798,801],{"class":58,"line":107},[56,796,797],{"class":759},"pip",[56,799,800],{"class":556}," show",[56,802,803],{"class":556}," requests\n",[56,805,806,808,811,814,817],{"class":58,"line":112},[56,807,51],{"class":759},[56,809,810],{"class":769}," -m",[56,812,813],{"class":556}," pip",[56,815,816],{"class":556}," install",[56,818,803],{"class":556},[14,820,821],{},"What these do:",[21,823,824,830,836,842,848],{},[24,825,826,829],{},[34,827,828],{},"python your_script.py"," runs your file",[24,831,832,835],{},[34,833,834],{},"python -c \"import math; print(math.sqrt(25))\""," tests an import quickly",[24,837,838,841],{},[34,839,840],{},"python -c \"import sys; print(sys.path)\""," shows where Python looks for modules",[24,843,844,847],{},[34,845,846],{},"pip show requests"," checks whether a package is installed",[24,849,850,853],{},[34,851,852],{},"python -m pip install requests"," installs a package",[14,855,856,857,92],{},"If you need help with installation, read ",[196,858,860],{"href":859},"\u002Fhow-to\u002Fhow-to-install-a-python-package-with-pip","how to install a Python package with pip",[42,862,864],{"id":863},"when-beginners-get-stuck","When beginners get stuck",[14,866,867],{},"These are common reasons imports fail:",[21,869,870,873,883,886,889],{},[24,871,872],{},"Misspelled module name",[24,874,875,876,879,880],{},"Using ",[34,877,878],{},"import myfile.py"," instead of ",[34,881,882],{},"import myfile",[24,884,885],{},"The module file is not in the same folder or Python path",[24,887,888],{},"The package is not installed",[24,890,891],{},"Your file name conflicts with a real module name",[287,893,895],{"id":894},"common-beginner-mistakes","Common beginner mistakes",[897,898,900,901,903],"h4",{"id":899},"using-the-py-extension","Using the ",[34,902,36],{}," extension",[14,905,906],{},"Wrong:",[47,908,909],{"className":49,"code":666,"language":51,"meta":52,"style":52},[34,910,911],{"__ignoreMap":52},[56,912,913,915,917,919],{"class":58,"line":59},[56,914,63],{"class":62},[56,916,675],{"class":66},[56,918,92],{"class":84},[56,920,680],{"class":461},[14,922,923],{},"Right:",[47,925,927],{"className":49,"code":926,"language":51,"meta":52,"style":52},"import helpers\n",[34,928,929],{"__ignoreMap":52},[56,930,931,933],{"class":58,"line":59},[56,932,63],{"class":62},[56,934,586],{"class":66},[897,936,938],{"id":937},"naming-your-file-the-same-as-a-standard-module","Naming your file the same as a standard module",[14,940,941,942,945],{},"If you name your file ",[34,943,944],{},"random.py",", then this can cause problems:",[47,947,949],{"className":49,"code":948,"language":51,"meta":52,"style":52},"import random\n",[34,950,951],{"__ignoreMap":52},[56,952,953,955],{"class":58,"line":59},[56,954,63],{"class":62},[56,956,957],{"class":66}," random\n",[14,959,960],{},"Python may import your file instead of the standard library module.",[14,962,963],{},"Try to avoid names like:",[21,965,966,970,975],{},[24,967,968],{},[34,969,944],{},[24,971,972],{},[34,973,974],{},"math.py",[24,976,977],{},[34,978,979],{},"sys.py",[897,981,983],{"id":982},"importing-a-package-that-is-not-installed","Importing a package that is not installed",[14,985,986],{},"This will fail if the package is missing:",[47,988,990],{"className":49,"code":989,"language":51,"meta":52,"style":52},"import requests\n",[34,991,992],{"__ignoreMap":52},[56,993,994,996],{"class":58,"line":59},[56,995,63],{"class":62},[56,997,803],{"class":66},[14,999,1000],{},"If needed, install it:",[47,1002,1004],{"className":750,"code":1003,"language":752,"meta":52,"style":52},"python -m pip install requests\n",[34,1005,1006],{"__ignoreMap":52},[56,1007,1008,1010,1012,1014,1016],{"class":58,"line":59},[56,1009,51],{"class":759},[56,1011,810],{"class":769},[56,1013,813],{"class":556},[56,1015,816],{"class":556},[56,1017,803],{"class":556},[42,1019,1021],{"id":1020},"faq","FAQ",[287,1023,1025,1026,1029,1030,1033],{"id":1024},"what-is-the-difference-between-import-math-and-from-math-import-sqrt","What is the difference between ",[34,1027,1028],{},"import math"," and ",[34,1031,1032],{},"from math import sqrt","?",[14,1035,1036,1038,1039,92],{},[34,1037,1028],{}," keeps the module name, so you write ",[34,1040,307],{},[14,1042,1043,1045,1046,1048],{},[34,1044,1032],{}," lets you write ",[34,1047,376],{}," directly.",[287,1050,1052],{"id":1051},"can-i-import-my-own-python-file","Can I import my own Python file?",[14,1054,1055,1056,1058,1059,92],{},"Yes. If your file is in the same folder and is named ",[34,1057,515],{},", you can usually write ",[34,1060,655],{},[287,1062,1064,1065,1033],{"id":1063},"why-do-i-get-modulenotfounderror","Why do I get ",[34,1066,736],{},[14,1068,1069],{},"Python cannot find the module. Check the spelling, file location, and whether the package is installed.",[287,1071,1073,1074,1033],{"id":1072},"should-i-use-from-module-import","Should I use ",[34,1075,1076],{},"from module import *",[14,1078,1079],{},"Usually no. It imports many names at once and can make code harder to read.",[42,1081,1083],{"id":1082},"see-also","See also",[21,1085,1086,1090,1095,1102,1107],{},[24,1087,1088],{},[196,1089,199],{"href":198},[24,1091,1092],{},[196,1093,1094],{"href":395},"How import works in Python",[24,1096,1097],{},[196,1098,1099,1100],{"href":740},"How to fix ",[34,1101,744],{},[24,1103,1104],{},[196,1105,1106],{"href":859},"How to install a Python package with pip",[24,1108,1109],{},[196,1110,1112,1113,1116],{"href":1111},"\u002Freference\u002Fpython-dir-function-explained","Python ",[34,1114,1115],{},"dir()"," function explained",[14,1118,1119],{},"Next, learn how Python finds modules and how to fix import errors when a module cannot be found.",[1121,1122,1123],"style",{},"html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .slqww, html code.shiki .slqww{--shiki-light:#6182B8;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sFwrP, html code.shiki .sFwrP{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#24292E;--shiki-default-font-style:inherit;--shiki-dark:#E1E4E8;--shiki-dark-font-style:inherit}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .stzsN, html code.shiki .stzsN{--shiki-light:#91B859;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":52,"searchDepth":70,"depth":70,"links":1125},[1126,1127,1128,1132,1136,1138,1142,1143,1146,1155],{"id":44,"depth":70,"text":45},{"id":162,"depth":70,"text":163},{"id":202,"depth":70,"text":1129,"children":1130},"Use import module_name",[1131],{"id":289,"depth":77,"text":290},{"id":317,"depth":70,"text":1133,"children":1134},"Use from module_name import name",[1135],{"id":382,"depth":77,"text":383},{"id":399,"depth":70,"text":1137},"Rename a module with as",{"id":505,"depth":70,"text":506,"children":1139},[1140,1141],{"id":519,"depth":77,"text":515},{"id":571,"depth":77,"text":574},{"id":686,"depth":70,"text":687},{"id":863,"depth":70,"text":864,"children":1144},[1145],{"id":894,"depth":77,"text":895},{"id":1020,"depth":70,"text":1021,"children":1147},[1148,1150,1151,1153],{"id":1024,"depth":77,"text":1149},"What is the difference between import math and from math import sqrt?",{"id":1051,"depth":77,"text":1052},{"id":1063,"depth":77,"text":1152},"Why do I get ModuleNotFoundError?",{"id":1072,"depth":77,"text":1154},"Should I use from module import *?",{"id":1082,"depth":70,"text":1083},"Master how to import a module in python in our comprehensive Python beginner guide.","md",{},"\u002Fhow-to\u002Fhow-to-import-a-module-in-python",{"title":5,"description":1156},"how-to\u002Fhow-to-import-a-module-in-python","xynxNily1CH2f4i9h6qvseUcdBafsuJeYuBW5HkRApw",1777585511195]