I have this code try2.py. I want it to access its user input from another python script defined in a class.
from pytube import YouTube
from try3 import t
class down:
def video(url,path):
y = YouTube(url)
video1 = YouTube(url).streams.first().download(path)
print(f"title:{YouTube(url).title}, views:{YouTube(url).views}, Length:{YouTube(url).length}")
print("Successfully done")
return video1
t2 = down()
t2.video()
The program which has user input is try3.py.
from pytube import YouTube
class vdoterm:
def __init__(self):
self.url = url
self.path = path
url = input("Enter the video URL: ")
path = input("Enter the path: ")
t = vdoterm(url,path)
I tried importing object "t", object "vdoterm" and access url but nothing worked. How to access a variable defined in another program?
vdotermacceptsurlandpath, however__init__ofvdotermdoes not show so..Also why cant you create an object ofdownclass directly ?try3.pywithtry2.py, nowhere intry3.pyare we calling anything oftry2.py