Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9120777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:42:00+00:00 2026-06-17T05:42:00+00:00

I have two python scripts, lets call them file1.py and file2.py , where I

  • 0

I have two python scripts, lets call them file1.py and file2.py, where I have different functions, let’s say that function11 and function12 are in file1. I need to use those functions in my file2.py function : function21.

Now the problem is that I have a simple error, but I need to make a ‘print’ of the variables to see exactly why I have those errors. But the errors are sent from one of the functions of file1 (that I am using from file2). And when I add some prints the results don’t appear in the terminal.

Is there some way that I can do this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:42:01+00:00Added an answer on June 17, 2026 at 5:42 am

    I’m not sure of what your script looks like, but you might try something like this (if you are not merely looking for a debugger):

    file1.py

    def function11(arg1, arg2):
        try:
            # try something with arg1, arg2 <---- throws error
            . . .
            # return something
        except:
            return arg1, arg2
    
    def function12(arg3):
        # try something else
        . . .
        return something
    

    file2.py

    from file1 import *
    
    def function21():
        try:
            # the following function should normally throw an error, but you have to be sure 
            # the result arg1, arg2 from function11 (in file1) still throws
            # an error and does not look like the expected result
            f = function11(arg1, arg2) 
            . . .
            return something
        except:     # <---- if function imported from file1.py throws error, you want to print variables instead.
            print arg1, arg2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two python scripts in different locations. I try to import the functions
I have two Python scripts in two different locations and cannot be moved. What
Let's say that we have a Python script do.py and we want to be
I have two python scripts that have to run simultaneously because they interact with
Let's say I have a simple script with two functions below. As callback_func is
I have two Python functions, both of which take variable arguments in their function
I have two python scripts. First python script calls second. But seconds python script
I have installed two different python versions (3.1 and 2,7) And this is now
I have two python scripts running as cronjobs . ScriptA processes log files and
I have two separate python scripts. One is for getting user location information (which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.