How can I get return value from A class to class B in python?

class InputForm(forms.Form):ㅤ
    attachment = forms.FileField()


class View1(FormView):
    template_name = 'main.html'
    form_class = InputForm

    def post(self, request) :
        I_want_this_file = request.FILES.get('attachment')
        return I_want_this_file

class View2:
    blar blar .....

When there's this structure,

Is there any way to get the value of I_want_this_file from a class called View2?

I understand that I have to hand over the parameters to get the return value.

But I couldn't bring it because of the "request".

When a user uploads a file from a template called main.html, I want to take the file itself, put it in the return value I_want_this_file, and bring the file itself to View2.

I have to bring that, but it's not my personal project, so there's no other way to add a file field than this.

I'd appreciate it if you could help me.

Is the following code what you need?

class InputForm(forms.Form):ㅤ
    attachment = forms.FileField()


class View1(FormView):
    template_name = 'main.html'
    form_class = InputForm

    def post(self, request) :
        I_want_this_file = request.FILES.get('attachment')
        return I_want_this_file

class View2:
    View1 = View1()
    I_want_this_file = View1.post(request)

If not, feel free to give me a feedback, and I'll edit my answer.

Back to Top