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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:31:04+00:00 2026-06-01T14:31:04+00:00

I am writing a code, wherein I will store few files into the data-structure

  • 0

I am writing a code, wherein I will store few files into the data-structure in memory, and will then use that data-structure in all the modules in order to access that data-structure. (time-saving)

Since the code is written in python, and is very big so its very hard to pass that data-structure from function-to-function.

Is there any possible way that I store the file-to-data-structure at the start of the code, and then I can use that data structure in any module, as that data structure is residing in the memory during the program execution.

Please help. Extremely important..!!

Let me give an example.

main.py ….. This is the start of the project, here I store the complete file-into-datastructure.
other_module.py ….. This is some other module, where in i want to access that data structure which must be residing in the memory, as main.py is in execution and it had called other_module.py.

Notice, I cannot store file-to-data structure thing inside other_module because then it would be very time-consuming, as here i am giving a very small example, but I am actually dealing with a bigger problem.

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-06-01T14:31:05+00:00Added an answer on June 1, 2026 at 2:31 pm

    Python variables and function arguments are always only references to objects, so don’t worry about passing a large data structure as a function argument: the data is not copied, only a new reference is created.

    However, if you know your code will always deal with only a single instance of the data structure, you can store it in a global variable. You could create a separate module that loads the data into a module-level variable, and import that module to main.py and other_module.py.

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

Sidebar

Related Questions

I'm writing an application wherein I have some debug code that I do not
I'm writing a small web app that will receive and parse tab-delimited text files
While writing code in a file that would comprise of PHP, HTML, CSS &
I am currently writing code in C++ to find all possible permutations of 6
I'm writing code to use UIImagePickerController. Corey previously posted some nice sample code on
While writing code, I often run into the problem of addressing trivial dependancies. For
I am writing code that involved a for loop that makes calculations at each
When writing code in Python, how can you write something next to it that
A common mistake when writing code that reads text from a stream in Java
I'm writing code that runs on Google App Engine (Java). What I'm trying to

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.