I have two files 'mod1.py' and 'mod2.py'.
mod1 requires request module to function. But I have not imported them in the mod1 instead I have imported both request and mod1 module in mod2.
But
I get an error 'name 'requests' is not defined'. I know it works if i Import 'request' module in mod1 directly it works fine. But I have other modules I want to use that requires 'request' module. So how do I import the module once and make in accessible to all the other modules ?.
mod1.py
class getUrl():
    def __init__(self, url):
        self.url = url
    def grab_html(self):
        html = requests.get(self.url).text
        return html
mod2.py
import requests
import mod1
module1 = mod1.getUrl('https://www.wikipedia.org/')
HTML = module1.grab_html()
Edit: Complete error
Traceback (most recent call last):
  File "C:\Users\camel\Desktop\test\mod2.py", line 5, in <module>
    HTML = module1.grab_html()
  File "C:\Users\camel\Desktop\test\mod1.py", line 6, in grab_html
    html = requests.get(self.url).text
NameError: name 'requests' is not defined
[Finished in 0.5s with exit code 1]
[shell_cmd: python -u "C:\Users\guru\Desktop\test\mod2.py"]
 
     
     
     
    