Calling eval inside a function is almost always the wrong thing to do. Often new Julia programmers make the mistake of trying to build up inner functions from strings or symbolic expressions that they eval, when the right thing is to just pass/define functions directly using ->.
Where do I find the file startup.jl? Also, I am not sure how I am using eval the way you suggest. Just to be clear, once I re-run the code the second time, I have no issue.
What I do: I create a mutable struct and then a function y that takes it as argument and runs a function x inside. Then I use pmap on the function y. Please let me know if I should provide any more detailed information. Thank you!
So, your startup.jl file is fine (in the future, please put your code between triple backticks (```) when posting to Discourse).
Wait, how/why are you trying to do this? You cannot normally define a struct within a function unless you use eval, and trying to call it normally within that same function will fail in the same way as you’ve experienced. Can you show what you’re doing, and briefly describe your end-goal?