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 7398371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:51:42+00:00 2026-05-29T03:51:42+00:00

Basically I have a application that sends a value to another function(located in another

  • 0

Basically I have a application that sends a value to another function(located in another file) and I want other functions(within that file) to have access(if it matters, its read access) to that variable.

For example:

def function1(pricelist):
     #do something

…. other functions

def fucntion200():
    #Does something else but needs to refer to that pricelist that was provided to function1

I tried doing a pricelist = pricelist in function1 so maybe if I declare it in the file it’ll be avail, but that didn’t work and when I make it global I get an error saying its local and global.

I have read: Using global variables in a function other than the one that created them and don’t think it fully applies(or I have so far been unable to).

Any ideas?

Thanks!

  • 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-05-29T03:51:43+00:00Added an answer on May 29, 2026 at 3:51 am

    It really depends on the control flow of your application. What is calling function1 and is it the one that ends up calling function200? At the very basic level, your function200 would take a pricelist arg as well, and modify it in place:

    def function200(pricelist):
        pricelist[0] = 50
    

    It would be most desirable to have one module using the other as a utility to where it can call the functions with the params it needs. Whatever is calling function1 could theoretically have access to function200 and call it as well.

    Using module globals should probably be reserved for constant values or things that aren’t going to be modified by a bunch of unknown sources, but it would be something like:

    moduleA.py

    constList = ['foo']
    

    moduleB.py

    import moduleA
    print constVal
    # ['foo']
    constVal.append('bar')
    

    But if all you are doing is writing top level functions, then they should all take parameters to operate on, and optionally return new versions or modify in place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have a working application that sends an SMS after receiving an SMS.
I have a Java program that generates Java classes for my application. Basically it
I have just made my first proper little desktop GUI application that basically wraps
I have created a powershell module (.psm1) file that includes a few other powershell
I have a view called send_confirmation email - which basically sends emails. I want
Basically I have an application that creates say 5 multicast sockets on the same
We have a console application (currently .NET) that sends out mail in bulk to
We have a set of applications that basically display a bunch of bitmaps and
I have basically two separate sites, a SharePoint collaboration site, and an ASP.Net application
I'm developing a small application using Blend, basically what I have in my application

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.